Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is this a CLASSPATH problem

Status
Not open for further replies.

rocknrisk

Programmer
May 14, 2002
43
GB
Hi all,

Up until now I have only developed in Java on a Win98 box, but now I have to complete a project on a WinNT network.

My problem is that my html page "cannot find class ****". I have no problem running the applet through Appletviewer or JDK Commander, but cannot run it directly in the page.

I have set the CLASSPATH in
"Control Panel/System/Enviroment/Path" as instructed by Sun but no luck.

Please help.

Thank you in advance.
Clinton [sadeyes] "Finish what you started"
 
Oh and I have installed the JRE with the Plugin. I am using Java 2 - 1.3.1.

Thank you. [tongue] "Finish what you started"
 
try converting the html using the HTML converter from sun (don't worry it is free to download). You will need to run your html page through this process before your browser can run the applet.
[pipe]
 
Make sure that you set up where your class files are located using the archive parameter for the applet. In appletviewer I know that you can set up your classpath explicitly, but when viewing from a html page, you must specify where you want the applet to look for our classes.

-gc "I don't look busy because I did it right the first time."
 
Thanks pipk and godcomplex,

Here's the weird bit. I can view other people's applets on the web but, cannot view mine.

Here's the applet tag in my html code:

<APPLET code=&quot;RootApplet.class&quot; height=&quot;100&quot; width=&quot;300&quot;></APPLET>

I feel so silly. This sould work.

Thanks
Clinton [reindeer]

&quot;Finish what you started&quot;
 
You need to include an archive tag that tells the we browser where your code exists.

<APPLET code=&quot;RootApplet.class&quot; archive=&quot;c:\myPath&quot; height=&quot;100&quot; width=&quot;300&quot;></APPLET>

By adding this line your browser will know where to go get your class files that are necessary to run your applet. I believe that you can also includ your class files in the directory where the RootApplet Class is located also. Make sure that you are using the correct package structure too when calling your applet. It is not enough to simply do code=&quot;RootApplet.class&quot; if you have packaged your code.

-gc &quot;I don't look busy because I did it right the first time.&quot;
 
Hmm, you could package your classes in a jar file and try accessing it from the archive or have you tried without the .class extension, I think that may throw some browsers off, but I'm not for sure on that one. Plus I would check to see what version of the JDK the browser is running, as it seems although the Java Plugin installed on my computer, IE never took it as the plugin to use for Java applets and used it's own Microsoft plugin for it which is like 1.2 from what I've heard.

JavaDude32
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top