I got an exception running XMLspark.jar because of my JRE version configured in the system.
How can i suggest another java that is residing in my system?
C:\Program Files\XMLSpark\XMLspark>java -jar XMLspark.jar
Exception in thread "main" java.lang.UnsupportedClassVersionError: base/MainWind
ow (Unsupported major.minor version 50.0)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:539)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:12
3)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
at java.net.URLClassLoader.access100ドル(URLClassLoader.java:55)
at java.net.URLClassLoader1ドル.run(URLClassLoader.java:194)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
This is the .bat file that runs the jar:
java -jar XMLspark.jar
asked Oct 22, 2011 at 9:50
HJW
23.6k51 gold badges147 silver badges218 bronze badges
1 Answer 1
Since you are running the code from a .bat file, you could give the full path name to the JRE with the appropriate Java executable.
Or, if that is an option, re-arrange the ordering in your %PATH% .
Assuming all the Java programs in your project require the same JRE, it's probably best to set JRE_HOME or JAVA_HOME.
answered Oct 22, 2011 at 10:01
S.L. Barth is on codidact.com
8,25271 gold badges55 silver badges68 bronze badges
Sign up to request clarification or add additional context in comments.
2 Comments
HJW
Hey Barth, am i able to supply the fully qualified path of the java executable into the .bat file directly?
S.L. Barth is on codidact.com
It should work. Something like "C:\Program Files\<Java-version>\bin\java -jar XMLspark.jar". There is a drawback, however, that it will make your code less portable.
lang-java