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 & HelpIntegration › Accessing data from a Java applet generated by PDE
Page Index Toggle Pages: 1
Accessing data from a Java applet generated by PDE (Read 2273 times)
Accessing data from a Java applet generated by PDE
Apr 14th, 2010, 6:05am
 
My simulation testbed consists of:

a. Processing Development environment.
b. Webserver
c. Data residing on Webserver
d. Exported sketchrun with data to Java applet.

I try to call loadStrings() to open a file from the webserver and
this gives me a Java exception
Unable to connect or resolve connection to localhost
in the animation thread.

I'd like to fix this problem. The PDE script works on my local host
but not on the applet.

When I import the data into the sketchbook as the reference
suggests, I can access the data file from the Java applet.

Is there a caveat in accessing data on a webserver from an applet generated by Processing?

Thanks,
Cartik
Re: Accessing data from a Java applet generated by PDE
Reply #1 - Apr 14th, 2010, 7:04am
 
Is your Web server on the same computer than your browser?
If not, you have to provide a valid URL to your server, not localhost.
If yes, ensure your Web server is correctly started.
Re: Accessing data from a Java applet generated by PDE
Reply #2 - Apr 16th, 2010, 4:21pm
 
The web server is started correctly. I provided the ip address as the
URl but that does not solve the problem.

Do I have to sign the applets generated so it shows up in the web browser?

Best regards,
Cartik
Re: Accessing data from a Java applet generated by PDE
Reply #3 - Apr 17th, 2010, 2:42am
 
What kind of URL you give to loadStrings()?
Re: Accessing data from a Java applet generated by PDE
Reply #4 - Apr 18th, 2010, 3:48pm
 
I specify

String lines[] = loadStrings("http://ipaddress.org/filename.htm");

to access data from the concerned Java applet.

best,
Cartik
Re: Accessing data from a Java applet generated by PDE
Reply #5 - Apr 19th, 2010, 1:13am
 
Strange, I hope you don't give something like "http://10.55.42.78.org/filename.htm" actually... Smiley

I still don't see what the problem can be. Can you download data from this address in a browser?

To answer your question, the applet must be signed only if accessing data from a server different from the one providing the applet.
And if that was the case, you should see (I think) a security error in the Java console.
Page Index Toggle Pages: 1