2

I downloaded the time series classification toolbox available here that I succeed to run with Netbeans (not with Eclipse due to compatibility problems) using the command

netbeans --jdkhome /usr/lib/jvm/java-1.8.0-openjdk-amd64/

I would like to be able to run it on a server so I need to be able to run it using command lines. However I didn't succeed. My guess is that there is a problem with jdk (I'm not used to Java so it might be something else), since when I run

sudo update-alternatives --config java

I get

There are 5 choices for the alternative java (providing /usr/bin/java).

  Selection    Path                                            Priority   Status
------------------------------------------------------------
  0            /usr/lib/jvm/java-9-openjdk-amd64/bin/java       1091      auto mode
  1            /usr/bin/gij-4.8                                 1048      manual mode
  2            /usr/bin/gij-4.9                                 1049      manual mode
  3            /usr/bin/gij-5                                   1050      manual mode
* 4            /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java   1081      manual mode
  5            /usr/lib/jvm/java-9-openjdk-amd64/bin/java       1091      manual mode

Which does not contains the path to the jdk I use with Netbeans. I didn't find a way to tell Java that I wanted to use another jdk, so I tried without:


Example where I run a specific main file

From TimeSeriesClassification/src:

javac timeseriesweka/classifiers/LearnShapelets.java 
java -cp ../bin:. timeseriesweka.classifiers.LearnShapelets

Error: A JNI error has occurred, please check your installation and try again

Exception in thread "main" java.lang.NoClassDefFoundError: TechnicalInformation

at java.lang.Class.getDeclaredMethods0(Native Method)

at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)

at java.lang.Class.privateGetMethodRecursive(Class.java:3048)

at java.lang.Class.getMethod0(Class.java:3018)

at java.lang.Class.getMethod(Class.java:1784)

at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)

at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)

Caused by: java.lang.ClassNotFoundException: TechnicalInformation

at java.net.URLClassLoader.findClass(URLClassLoader.java:381)

at java.lang.ClassLoader.loadClass(ClassLoader.java:424)

at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)

at java.lang.ClassLoader.loadClass(ClassLoader.java:357)

... 7 more

Any help on how to set up correctly Java will be appreciated


With (following the answer of ACV)

java -cp ../bin/Test.jar:lib/*:. timeseriesweka.classifiers.LearnShapelets

Exception in thread "main" java.lang.BootstrapMethodError: java.lang.NoClassDefFoundError: java/lang/invoke/StringConcatFactory
    at timeseriesweka.classifiers.LearnShapelets.main(LearnShapelets.java:746)
Caused by: java.lang.NoClassDefFoundError: java/lang/invoke/StringConcatFactory
    ... 1 more
Caused by: java.lang.ClassNotFoundException: java.lang.invoke.StringConcatFactory
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 1 more

1 Answer 1

1

Try this:

-cp "../bin/Test.jar:lib/*:." instead of your:

-cp ../bin:.

Sign up to request clarification or add additional context in comments.

4 Comments

Got a different error: Exception in thread "main" java.lang.BootstrapMethodError: java.lang.NoClassDefFoundError: java/lang/invoke/StringConcatFactory at timeseriesweka.classifiers.LearnShapelets.main(LearnShapelets.java:746) Caused by: java.lang.NoClassDefFoundError: java/lang/invoke/StringConcatFactory / Caused by: java.lang.ClassNotFoundException: java.lang.invoke.StringConcatFactory (I'll had the full error in the question)
That's a Java 9 class. So you need java 9 to run that: docs.oracle.com/javase/9/docs/api/java/lang/invoke/…
javac -version returns: javac 9-internal whereas java -version returns openjdk version "1.8.0_151" So if I understand well I just need to update my JDK version?
You need both to be the same java 9

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.