Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

standard CLASSPATH

 
Bob Moranski
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I was wondering if anyone knows what the standard CLASSPATH is?
Thanks in advance!
 
Tony Alicea
Desperado
Sheriff
Posts: 3226
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
(Universally) "Standard"? I don't think there's such a thing
 
Bob Moranski
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I meant for servlets in tomcat.
 
maha anna
Ranch Hand
Posts: 1467
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bob,
ClassPath we all know. From which doc you got this doubt specifically?
regds
maha anna
 
Bob Moranski
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi maha, say if we want to load an Applet that is on a separate file into our servlet? We have to place the Applet file in the standard CLASSPATH. Can you tell me what is it?
 
maha anna
Ranch Hand
Posts: 1467
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The applet's .class file or .jar file has to be in a directory whose'just before' directory has to be in environment var 'CLASSPATH'. For example if you package an applet's myApplet.class file in 'MISApp' package and you want to load this .class file in a .html/.jsp file then, there has to be directory structure /MISApp/myApplet.class and the parent dir which holds this MISApp , assume it is c:\bob\ , has to be set in CLASSPATH environment variable. For example in windows environment , we add a line as
set classpath=c:.;C:\bob
(in case of c:\bob\MISApp\myApplet.class )
so that the JVM knows where to get 'myApplet.class'. Other than this concept , I am not sure if the word 'standard classpath' is different from 'classpath' or not. Others can add to this.
regds
maha anna
 
Bob Moranski
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi maha, so if we wish to load myApplet.class in MISAPP, then we put it in c:\tomcat\webapps\MISAPP\myApplet.class? Outside of Web-inf?
Thanks.
 
maha anna
Ranch Hand
Posts: 1467
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bob,
Sorry for the late reply. As per Servlet 2.2 API spec all .class files go into ROOT/Web-Inf/classes directory and the servlet container's supposed to set the ROOT/Web-inf/classes dir in JVM's classpath.
I tried putting an applet's .class file in above said classes dir and kept the .html file in /ROOT dir and called from browser. But the applet was not loaded.
Then I tried to put the .html file and applet's .class file in same /ROOT dir and tried to call this .html file from browser. Now the applet is loaded.
Another try which worked was, I kept the applet's .class file from an unrelated dir which could be separate from web server's deployment dir structure itself. Like it could be from c:\bob\myApplet.class and put c:\bob in classpath by editing the autoexec.bat file.
Now also when I called the .html file from browser, the applet in c:\bob dir was loaded.
So , yet to figure out why it was not loaded when I kept the applet's class file in /ROOT/Web-inf/classes dir.
Others can add to this.
regds
maha anna
 
Bob Moranski
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
maha, you are so nice!
[This message has been edited by Bob Moranski (edited December 29, 2000).]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic