amten/NeuralNetwork

[error launching weka] java.lang.UnsupportedClassVersionError: weka/gui/GUIChooser : Unsupported major.minor version 52.0

Floryndas opened this issue · 6 comments

Hello,
I'm using weka 3.6.10-2. After installation, that's the error I have when I tried to launch weka:
$weka
[warning] /usr/bin/weka: Unable to locate libsvm.jar in /usr/share/java
Exception in thread "main" java.lang.UnsupportedClassVersionError: weka/gui/GUIChooser : Unsupported major.minor version 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)

When i looked this issue #2 , i tried to see my own java version and I have java 1.8 in my computer, so I don't what'is the matter. Can you help me to fix it please?

On Apr 16, 2015, at 9:40 PM, Floryndas notifications@github.com wrote:

Exception in thread "main" java.lang.UnsupportedClassVersionError: weka/gui/GUIChooser : Unsupported major.minor version 52.0

Probably not my place to say but you’re picking something up compiled with Java 8
https://en.wikipedia.org/wiki/Java_class_file
J2SE 8 = 52 (0x34 hex)

recompile the project should correct that.

Michael Hall

Hi Floryndas,

If you are running the Weka Gui from its starting script I think it uses the Java version that is distributed with Weka package (so one different than yours), I am using Weka 3.6.13 and the disturb embeds a Java 1.7
If you want to use your Java 8, you only have to locate the weka jar file and run the following
java -cp path/to/weka.jar weka.gui.GUIChooser

On Dec 20, 2015, at 7:38 PM, Tarek TURKI notifications@github.com wrote:
If you want to use your Java 8, you only have to locate the weka jar file and run the following
java -cp path/to/weka.jar weka.gui.GUIChooser

This ones a little dated by now. Weka itself might be compiled as Java 8 now.
I’m not sure what the advantage would be to using a later java version than Weka expects if its not. You would be more likely not to encounter java version problems if you use the same java version as everyone else using the application.
NeuralNetwork was compiled with a later version that included a different major.minor class version causing a version incompatibility error.
Recompile it as Java 7 would make it usable as normal.
This is what I did. I thought I included information on how to do that compile/jar command line in my post, although I’m not seeing it in the thread now.
Your way works too but is a little more manual. You have to locate the Weka jar and launch from some sort of command line console. (Not that I have anything against those either).

Michael Hall

installation of a new package, RankerByDTClassification, is throwing this same error on startup:
Exception in thread "main" java.lang.UnsupportedClassVersionError: weka/classifiers/trees/ArffAttributeName : Unsupported major.minor version 52.0
removing the package from $WEKA_HOME/packages allows weka to startup normally.

On Dec 28, 2015, at 8:23 AM, Rik Belew notifications@github.com wrote:

installation of a new package, RankerByDTClassification, is throwing this same error on startup:
Exception in thread "main" java.lang.UnsupportedClassVersionError: weka/classifiers/trees/ArffAttributeName : Unsupported major.minor version 52.0
removing the package from $WEKA_HOME/packages allows weka to startup normally.

This wouldn’t have anything to do with this package (NeuralNetwork). I don’t know if it includes what you need to recompile like NerualNetwork does. If it does my suggested solution would be the same. Recompile it to use the same jdk as Weka uses. If source is not available the command line launch suggestion to use it with a later jdk version would probably be the only way to go.

Michael Hall

I had this same problem on Arch Linux 4.16.9-1-ARCH.

I solved it and was able to run Weka by switching from java-7-openjdk/jre to java-9-openjdk using the archlinux-java utility (this will be different for other kernels).