I am receiving java bad version number in .class file when I try to open a simple applet in my browser (I have tried Firefox and Safari). My browsers stat that I am using a 1.5.X JRE, but my command line compiler is 1.6.x. I can't quite figure how to sync the two of these VM's, as I am not the most adept Mac user. I have tried the native software update feature, but there is no Java update available there. I've also tried updating in each browser, but I just get redirected to the Mac OS X Software Update feature.
2 Answers
while compiling files, you have to use -target option.
Example, javac -target 1.5 [source file]
More explanation is available at http://docs.oracle.com/javase/1.4.2/docs/tooldocs/windows/javac.html
For an Oracle JDK, you'd simply use the cross-compilation options of javac
.
Note that is important to specify -source
, -target
& -bootclasspath
for the compilation. That last one requires a JRE of the target version, to check the classes, methods & attributes used in the code actually existed in the target version.