[brailleblaster] Re: Braille Blaster and Java versions

  • From: "Michael Whapples" <mwhapples@xxxxxxx>
  • To: <brailleblaster@xxxxxxxxxxxxx>
  • Date: Sun, 11 Mar 2012 00:51:28 -0000

I think it is only likely for code compiled on either the same JVM version or lower will run on a given JVM. You may be able to compile on a newer JVM by specifying the target JVM version.


Some examples:
You compile on JDK6 and run on Java6, should work fine.
You compile on JDK6 and run on Java7, should work.
You compile on JDK7 and run on Java6, will not work unless when compiling you specify target byte code for Java6.

To specify the target version use the -target<version> option where version is the Java version to support in the byte code.

For example -target1.6 given to the javac command will compile to byte code which can be run on Java6.

Similar to this, if you want to make sure your source code is valid for a given Java release then give the -source<version> option and that will set -target to it if you don't specify -target.

I don't know how one specifies the target or source options in ant, its probably possible as other systems like maven support them.

I hope that makes it all clear.

Michael Whapples

-----Original Message----- From: Vic Beckley
Sent: Sunday, March 11, 2012 12:30 AM
To: brailleblaster@xxxxxxxxxxxxx
Subject: [brailleblaster] Braille Blaster and Java versions

John,

I am compiling Braille Blaster and the DLLs using version 7 of the Java JDK.
I am having no problems with running what I compile on the same Java
version. I just gave a copy of my 32-bit version to a friend to try out. He
is running Java version 6. It won't run. He gets the below error. I also
tried it on my laptop, which also has Java 6, and got the same error.

Exception in thread "main" java.lang.UnsupportedClassVersionError:
org/brailleblaster/Main : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(Unknown Source)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$000(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
Could not find the main class: org.brailleblaster.Main. Program will exit.

Any ideas what would cause this? Will I have to compile with Java 6? If so,
will it run on Java 7?

Is anyone running my 32-bit Windows release of Braille Blaster 1.3.0
successfully? If so, what Java version do you have?


Best regards from Ohio, U.S.A.,

Vic
E-mail: vic.beckley3@xxxxxxxxx





Other related posts: