This week's book giveaway is in the Java in General forum.
We're giving away four copies of Helidon Revealed: A Practical Guide to Oracle’s Microservices Framework and have Michael Redlich on-line!
See this thread for details.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Applet runs only if class file is in the same dir

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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)
 
Ranch Hand
Posts: 299
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Put all the files in a .jar. Specify the path to the jar in the APPLET tag.

Brian
 
Arun Datta
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 299
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
reply
    Bookmark Topic Watch Topic
  • New Topic