• 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

Problem when calling applet

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I am facing problems when I try to execute an applet from a Struts application, I have seen some threads but none posted the last code to resolve it.

I want to call an applet from one of my jsp's under web/jsp

I created the folder applets under web as well and I placed the JavaApplication15.jar which is only a Main.class (no packages, no libs... just a System.out.println to know if it is being called)



it works if I call the applet from a static html file with


I have tried to include this applet into my struts app but I always get "java.lang.ClassNotFoundException: Main.class"

I tried to copy the jar into web/applets and call it with or
I tried to unpack the jar,place the classes under web/applets/JavaApplication15 and call with
unpack the jar,place the classes under web/applets/ and call with

I even tried to copy Main.class to the same folder where I have the JSP /web/jsp/admin and call with without "archive" or "codebase"

Whatever I try, I always get the ClassNotFoundException. What am I doing wrong!

Thank you!

 
Dani Acedos
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
this is the stack of the javaconsole
 
Saloon Keeper
Posts: 7585
176
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Does https://localhost:8443/Stimula/applets/Applet.jar exist? What happens if you paste that URL into a browser - can you download the jar file?

You should not use an applet's constructor, by the way. An applet's lifycycle is handled by the browser - if you need to do something when the applet is created, override its init() method and put your code there.
 
Dani Acedos
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I checked and yes, and I can download the jar if I paste the url.

I add, I try to run the applet in Firefox, If I try in IE I get another error: java.lang.RuntimeException: java.lang.ExceptionInInitializerError.

Probably due to permissions?

Thanks!
 
Ranch Hand
Posts: 77
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Besides all the sage advice offered by Tim, I'll just point out that calling in an applet does not make much sense no matter what the value is.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic