aspose file tools*
The moose likes Applets and the fly likes Applet runs only if class file is in the same dir Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "Applet runs only if class file is in the same dir" Watch "Applet runs only if class file is in the same dir" New topic
Author

Applet runs only if class file is in the same dir

Arun Datta
Greenhorn

Joined: Jan 06, 2004
Posts: 2
Hi I am facing a problem with applets, they are not running if the applet class files are not in the same dir as that of the html file.
1.Pls suggest with sample how to change the .java.policy file so that the applet /object tag can read from a jar file placed in a different folder.
2.Putting the dir entry in the system path also does not help.
What are the ways to make the applet classloader look for byte code in the system path
3. Suggest any other way that will solve my problem...
Your help will be appritiated.
I am using IE6 with JRE 1.4.2.01
I have recently started facing this problem (after moving to 1.4 ver or JRE)
Brian Pipa
Ranch Hand

Joined: Sep 29, 2003
Posts: 299
Put all the files in a .jar. Specify the path to the jar in the APPLET tag.

Brian


My Java Freeware:<br />MACCC - <a href="http://maccc.pipasoft.com" target="_blank" rel="nofollow">http://maccc.pipasoft.com</a><br />Nator - <a href="http://nator.pipasoft.com" target="_blank" rel="nofollow">http://nator.pipasoft.com</a>
Arun Datta
Greenhorn

Joined: Jan 06, 2004
Posts: 2
I have tried this it works only if the jar file is in the relative path w.r.t the html/jsp file.
But if I put the jar myjar.jar in c:\dir1 and the html file in the c:\dir2, it doesn't work(c:\dir1\myjar.jar is in the system path and classpath).
The applet only tries to find it in the relative path, I can't use codebase and give the actual physical path (it works if I do)I want my code to be independent of the location of the jar.
Do you still have any more thoughts ??
Brian Pipa
Ranch Hand

Joined: Sep 29, 2003
Posts: 299
You've confused me a bit. I still don't feel like I have all the info I need, but I'm going to make some guesses - hopefully they will be right.
<BEGIN GUESSES>
You have a 3rd party library in a jar. Let's call it 3rdparty.jar
You wrote a class or classes that use the jar.
</BEGIN GUESSES>
Assuming those 2 statements above are correct.....
Put your class or classes into a jar of its own. Let's call it myjar.jar. Now do something like this in the HTML:

If the HTML is in c:\html and the 3rdparty jar is in c:\3rdparty and your jar is in c:\myjars you can use this:

If you are still having problems, try reading this:
http://java.sun.com/products/jdk/1.2/docs/guide/jar/jarGuide.html
Brian
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Applet runs only if class file is in the same dir
 
Similar Threads
Problem in playing audio in Applet
Problme Running Midi (.mid) files in Applet
Applet is not getting loaded in client machine
AdviceClient Solution
Class HibernateUtil cannot be resolved