Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Weird InstantiationException problem in IE (MSJVM) - due to caching?

 
James Hodgkiss
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The name of my applet class was MyProjectApplet.class, packaged in a jar (unsigned) called MyProject.jar. My html code was:

<applet code="myPackage.MyProjectApplet.class" archive="MyProject.jar" width="180" height="45">
</applet>

It all worked fine, then recently I needed to make a few changes to the MyProjectApplet code but, when testing it out, I noticed that these changes were not being picked up in IE - IE was still using the old code. (The new code ran fine in Firefox.)

Assuming the problem was down to IE caching the old class files, I cleared the IE cache (Tools -> Options -> Delete Files) - but the problem persisted...

So, to overcome the caching, I decided to rename my class and jar - to MyProjectApplet_New.class and MyProject_New.jar, changing my html code to:

<applet code="myPackage.MyProjectApplet_New.class" archive="MyProject_New.jar" width="180" height="45">
</applet>

And now I get the following message when IE tries to load my applet:

java.lang.InstantiationException: myPackage/MyProjectApplet_New
at com/ms/applet/BrowserAppletFrame.newInstance
at com/ms/applet/AppletPanel.processSentEvent
at com/ms/applet/AppletPanel.processSentEvent
at com/ms/applet/AppletPanel.run
at java/lang/Thread.run

And the strangest thing is that if I now use this html:

<applet code="myPackage.MyProjectApplet.class" archive="MyProject_New.jar" width="180" height="45">
</applet>

...that is, specifying the new jar but with the old applet class name (that doesn't even exist in the new jar), then the applet runs! (But it runs the old code, not the new code...)

Does anyone know what is going on? Have I missed something really obvious?

Thanks,
James
 
James Hodgkiss
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
At long long long long last, I've found the cause of the problem!...

For some reason, all my classes were being stored in my C:\WINDOWS\Java\lib directory!...

I don't know why, but I've deleted them and things are back up and running.

Happy days!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic