Hi, I don't know if this is the right, but i have a problem with the msjvm (yes, it's old, but VRML JSAI run only with this). I want to read some data from a text file, but everytime I get the File NotFoundException... The file is on the application directory.
Here the code:
public class suono extends Script {
public void initialize() {try {
if (Class.forName("com.ms.security.PolicyEngine") != null)
PolicyEngine.assertPermission(PermissionID.SYSTEM);
System.out.println("inizio");
}
catch (Throwable cnfe) { }
}
public void processEvent(Event e) {
if(e.getName().equals("attivo")) {
System.out.println("ciao");
try {
FileReader fis = new FileReader("uno.txt");
int c= fis.read();
System.out.println (c);
fis.close();
}
catch (IOException ex) {System.out.println (ex.toString());}
}
}
The Jsai work in a Sandbox like an applet, then i sign my file and i put it on a .cab file.
For Example, if I run this in the same directory, it works:
public static void main (String args[]) {
try {
FileReader fis = new FileReader("uno.txt");
char c=(char) fis.read();
System.out.println(c);
}
catch (IOException e) {System.out.println(e.toString());}
}
Can Someone Help me?