I've written a simple Java applet to generate a technical image based upon some data in a CSV file. I'm passing in the CSV file as a parameter to the applet:
<applet code = "assaymap.AssayMapApplet" archive = "http://localhost/applet_test/AssayMap.jar" height="600px" width="800px">
<param name="csvFile" value="http://localhost/applet_test/test.csv">
</applet>
As far as I understood applet security restrictions, an applet should be able to read data from the host they're on.
These applets here http://www.jalview.org/examples/applets.html are using the same approach of passing in a text data file as a parameter. So I'm not sure why my own applet isn't working.
I'm reading the file using the javacsv project on sourceforge.
My code for reading the CSV file is:
public static ArrayList<Assay> getData(String file) throws FileNotFoundException, IOException {
ArrayList<Assay> assays = new ArrayList<Assay>();
CsvReader reader = new CsvReader(file);
reader.readHeaders();
while (reader.readRecord()){
int assay_id = Integer.valueOf(reader.get("assay_id"));
String assay_name = reader.get("assay_name");
float distance = Float.parseFloat(reader.get("distance"));
assays.add(new Assay(assay_id, assay_name, distance));
}
return assays;
}
The error message I get thrown is:
Error with processing the CSV data.
java.security.AccessControlException: access denied (java.io.FilePermission http:\localhost\applet_test\test.csv read)