I am trying to run this example
but it is giving me “Bad version number in .class file…” error. i’m using jdk version 1.6 and example asks to use jdk 1.5. java should support downward compatibility. how can i run the example with jdk 1.6?
I am trying to run this example but it is giving me Bad version
Share
There’s a subtle trap here that many new folks fall into. Sometimes — often, actually — you may have a copy of
java.exefrom an older JDK installed on your machine, appearing early in your path, that you don’t know about. You can get into the situation where you compile classes with your shiny new JDK 1.6 compiler, and then try to run them with the oldjava.exe, and get the error mentioned here. If that oldjava.exe‘s location is earlier on your path than the JDKbindir, then you’ll find the compiler from the command line, but not the right version ofjava.exeitself.The extra
java.exewas often installed by an old installer for the Java Plug-In — the thing that lets you run applets in your web browser. The roguejava.exeis likely in yourWINDOWSdirectory, or some variant (this is a peculiarly Windows-centric problem).If you’ve installed JDK 1.6 including the Java plugin, then you can simply delete the copy of
java.exein your WINDOWS directory. If you don’t want to do that, you should change your path so that the JDK’sbindirectory is beforeWINDOWS.