Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!
  • 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 ...
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • salvin francis
  • fred rosenberger

Can't run demo applets - Bad major version #

Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
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.
javac -source 1.3 ....
(where the dots are the rest of your normal compile statement.)
Jeff Fisher
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" 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 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
Who among you feels worthy enough to be my best friend? Test 1 is to read this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
    Bookmark Topic Watch Topic
  • New Topic