• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

ClassNotFoundException

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi all
i m running a very simple applet .as i m new to it.
i try to run it in two different ways as follows
-------------------------------------------------------------------------
Case 1. I put XmlTreeAppletDemo.class and XMLTreeAppletDemo.html into

D:\tomcat\jakarta-tomcat-3.3.1a\webapps\xml-tree-example\WEB-INF

in this case XMLTreeAppletDemo.html contains

<Applet code= "XmlTreeAppletDemo,class" width = "200" height="200">
</Applet>



it works fine and applet get initialized using appletviewer utility.

this works because class file and html file are in the same folder.
---------------------------------------------------------------------------
Case 2. I put XmlTreeAppletDemo.class into

D:\tomcat\jakarta-tomcat-3.3.1a\webapps\xml-tree-example\WEB-INF\classes
and XMLTreeAppletDemo.html in

D:\tomcat\jakarta-tomcat-3.3.1a\webapps\xml-tree-example\WEB-INF

in this case XMLTreeAppletDemo.html contains

<Applet code= "/classes/XmlTreeAppletDemo,class" width = "200" height="200">
</Applet>

but when i run XmlTreeAppletDemo.html using appletviewer utility from

D:\tomcat\jakarta-tomcat-3.3.1a\webapps\xml-tree-example\WEB-INF directory

i am facing this Exception


load: class /classes/XmlTreeAppletDemo.class not found.
java.lang.ClassNotFoundException: .classes.XmlTreeAppletDemo
at sun.applet.AppletClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.applet.AppletClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.applet.AppletClassLoader.loadCode(Unknown Source)
at sun.applet.AppletPanel.createApplet(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.io.FileNotFoundException: \classes\XmlTreeAppletDemo.class (The
system cannot find the path specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(Unknown Source)
at java.io.FileInputStream.<init>(Unknown Source)
at sun.net.www.protocol.file.FileURLConnection.connect(Unknown Source)
at sun.net.www.protocol.file.FileURLConnection.getInputStream(Unknown So
urce)
at sun.applet.AppletClassLoader.getBytes(Unknown Source)
at sun.applet.AppletClassLoader.access$100(Unknown Source)
at sun.applet.AppletClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
... 9 more




can anyone tell me where i m wrong ?
does classpath matters for this ?
i have set my classpath as

D:\tomcat\jakarta-tomcat-3.3.1a\webapps\xml-tree-example\WEB-INF\classes

i will be highly thank ful to u all.
regards
naveen
 
Rancher
Posts: 5008
38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The HTML file with the <applet tag and the applet class files should be in the same directory on the server.
The browser does an HTTP GET for the HTML and then does an HTTP GET for the objects referenced in the HTML page including the applet classes. The default path (codeBase) will be to the same directory as the HTML file.
 
naviknit khanna
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thank you dear
it worked
i used a war file and a jsp to run my application.
i plugged in my applet into that jsp
thank you for your help.
naveen
 
reply
    Bookmark Topic Watch Topic
  • New Topic