• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

Can't run demo applets - Bad major version #  RSS feed

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I am currently unable to bring up any of the SDK demo applets on my PC's browser. I remember that I was able to do this when I first began to learn Java a couple of years ago. About a year ago I noticed that I needed to run appletviewer to see the demo applets, but that didn't bother me. Now, however, I have installed Tomcat and am trying to learn JSP. I can move from an HTML form to a JSP and back again, which indicates to me that Tomcat is working, but none of the Java code on the JSP works. I know this is not a JSP forum, but I supect that my problem with viewing applets in my browser is related.
I use Windows 98. One of the first things I tried was to reinstall Java. I currently have Java SDK version 1.4.2_02 installed. After reinstalling the SDK didn't work, I tried installing the same version of the JRE (alongside the JDK), even though it is my understanding that the functionality in the SDK is a superset of the JRE functionality. In Internet Explorer, under the Internet Options Advanced tab, I have all the options for Java checked, including "Use Java 2 v1.4.2_02 for <applet>."
When I try to run a demo applet in IE by clicking on the associated HTML file, I get a ClassNotFoundException that shows up in the Java Console (it looks like IE is trying to use the MSJVM - is evil Microsoft causing this problem?). However, when I try to use Netscape, I get a different error message: "ClassFormatError: Bad major version number." In both cases I can tell that I've clicked on the correct HTML file (the proper heading shows up, along with a link to "The source." Also, I've checked the HTML file using Notepad). Again, I can use appletviewer and the applets work just fine - the problem only occurs within a browser.
Can somebody help me with this?
Thanks very much, Jeff
 
Bartender
Posts: 2205
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What plug-in version of the JVM are you using with your browsers? It must be at least 1.4.2 if you want to run apps you compiled with the 1.4.2_02 JDK.
One quick thing you might try is recompiling with the -source flag which "provide[s] source compatibility with specified release."
Lets assume for example your Plug in uses the 1.3 JVM.
try
javac -source 1.3 ....
(where the dots are the rest of your normal compile statement.)
 
Jeff Fisher
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, Rob. I get the same type of error message (java.lang.ClassFormatError) whether I use Netscape or Internet Explorer. I wasn't really aware of the issue of browser plug-ins before looking around in this forum.
In Netscape, when I choose menu option Help followed by About Plug-ins, it says that the "Java Virtual Machine for Netscape" is enabled. It lists file names and includes the heading "Java Plug-in 1.4.2_02 for Netscape Navigator (DLL Helper)." This plug-in must have been installed as part of the JDK installation process - I know I didn't install it myself.
I don't see a similar "About Plug-ins" menu option in IE, but when I view the Java console in IE it says "Microsoft (R) VM for Java (tm), 4.0 Release 4.79.0.2424." And under Tools, Internet Options, Advanced tab, a box is checked that says "Use Java 2 v1.4.2_02 for <applet> (requires restart)."
I did try to use the -source compiler directive for the "Blink" demo applet (javac -source 1.4 Blink.java). The compile went OK, and the Blink applet still works in appletviewer, but I still get the same error when I try to run the applet in either Netscape or IE.
My PC is about 5 years old, and it's been my experience that weird things can happen on obsolete computers. I'm thinking about buying a new PC, but everything else still seems to work, and I'm not sure I can blame this problem on my current machine.
I appreciate your time with this. Happy Holidays, Jeff
 
Live ordinary life in an extraordinary way. Details embedded in this tiny ad:
how do I do my own kindle-like thing - without amazon
https://coderanch.com/t/711421/engineering/kindle-amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!