We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › Exported Applet fails (sketchPath)
Page Index Toggle Pages: 1
Exported Applet fails (sketchPath) (Read 487 times)
Exported Applet fails (sketchPath)
Oct 5th, 2007, 2:42am
 
My Processing sketch starts up fine when running within Processing.

When I "Export" the sketch and run it as an applet within a web page, I get the following error dumped into my Java console.  Am I doing something wrong?

I seem to need a "FileInputStream" to pass to the Properties object, otherwise I would try to use a Processing-style "loadStrings" ...

Any suggestions would be appreciated.

thanks,
 djones


Code:
Error while running applet.
java.lang.RuntimeException: The applet was not inited properly, or security restrictions prevented it from determining its path.

at processing.core.PApplet.sketchPath(PApplet.java:4686)
at processing.core.PApplet.savePath(PApplet.java:4716)
etc.


Code:
import java.io.FileInputStream;
import java.util.Properties;
import org.w3c.dom.Document;

void initialize() {
FileInputStream input = null;
Properties prop;
Document d = null;

try {
input = new FileInputStream(savePath("settings.conf"));
} catch (FileNotFoundException e) {
println(e.getMessage());
e.printStackTrace();
return;
}
prop = new Properties();
try {
prop.load(input);
} catch (IOException e) {
println("IO exception");
}
name = prop.getProperty("name");

Re: Exported Applet fails (sketchPath)
Reply #1 - Oct 5th, 2007, 9:41am
 
"security restrictions prevented it from determining its path"

tried openStream() already

something like (untested):
Code:

prop = new Properties();
try {
prop.load(openStream("yourfilename.here"));
} catch (IOException e) {
println("IO exception");
}
name = prop.getProperty("name");


F
Page Index Toggle Pages: 1