java applet not loading image with relative path but loads image with absolute path
java applet not loading image with relative path(e.g. images/1.jpg) but loads image with absolute path(i.e. from /root/user/images/1.jpg) . This is a problem when i want to host the applet on web server
A couple of problems/questions here:
1. If this is really an "applet"...
... then it's executing on the *client's* PC...
... and the client won't necessarily have an "images/" directory.
2. You're assuming that the Java program's working directory is "/root/user". This *isn't* necessarily true.
Put a debug statement in your code:
'Hope that helps .. PSM
Here's code for reading a local file from a Java applet:
thanks ,issue resolved , getResource worked out
|All times are GMT -5. The time now is 09:09 PM.|