AWS Ubuntu java.lang.ClassNotFoundException: Jama.Matrix - java

I am trying to run a mutation clustering algorithm described in
https://tinyheero.github.io/2015/08/26/TrAp.html
Running java -jar TrApWithDependencies.jar --text figure1.txt works fine on my laptop running windows 10, but not on AWS ubuntu. I would like to run it on my AWS instance because the algorithm is very RAM hungry and will run out of memory for input data with 50 or more rows.
Running it on Ubuntu Server 18.04 LTS gives me the following error. I believe the key issue is with Jama.Matrix
Exception in thread "main" java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
Caused by: java.lang.NoClassDefFoundError: Jama/Matrix
at klugerlab.trap.data.Solution.fitClones(Solution.java:703)
at klugerlab.trap.algo.MinimalClonesSolver.processTemplate(MinimalClonesSolver.java:168)
at klugerlab.trap.algo.MinimalClonesSolver.completeSolutions(MinimalClonesSolver.java:204)
at klugerlab.trap.algo.MinimalClonesSolver.runSolver(MinimalClonesSolver.java:250)
at klugerlab.trap.algo.Solver.run(Solver.java:229)
at klugerlab.trap.algo.Job.run(Job.java:97)
at klugerlab.trap.TrApMain.main(TrApMain.java:120)
... 5 more
Caused by: java.lang.ClassNotFoundException: Jama.Matrix
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:471)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 12 more
I do not have access to the source code, only the .jar file.

Related

Running java code on Linux, and the code is written in IntelliJ in windows and CPLEX libraries are used, as well as I got input data from txt filex

I have a problem to run my java code on Linux. I wrote the code in IntelliJ on windows environment and it works. The code needs CPLEX libraries and I get data from txt files. Now, I want to run this code on Linux, but I got these errors:
Exception in thread "main" java.lang.NoClassDefFoundError: ilog/concert/IloException
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:650)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:632)
Caused by: java.lang.ClassNotFoundException: ilog.concert.IloException
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
I compiled the code first, and then run it. I do not know how can I run my code. Could you help me please?
for compiling the code I used this command:
javac -classpath /opt/ibm/ILOG/CPLEX_Studio128/cplex/lib/cplex.jar /home/../MIP_Case1/src/MIP.java
Thank you so much for your help.

kaptDebugKotlin crashes when building with Java Version 11 or higher

I'm getting an IllegalStateException/NoClassDefFoundError when trying to run the command ./gradlew :data:test on my project (https://github.com/guger/MoneyBook). This error does occur when I'm using a Java Version higher than 11. I'm not able to use the jdk bundled into the IDE, since robolectric requires Java 9 or higher, when testing against Android Q and Java 9 does not work as it provides it's version string in a format which is not recognized by robolectric.
java.lang.IllegalStateException: failed to analyze: java.lang.NoClassDefFoundError: com/sun/tools/javac/file/BaseFileObject
at org.jetbrains.kotlin.analyzer.AnalysisResult.throwIfError(AnalysisResult.kt:56)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules$cli(KotlinToJVMBytecodeCompiler.kt:182)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:164)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:54)
at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:84)
at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:42)
at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:104)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:1558)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:567)
at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:359)
at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:200)
at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:197)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:689)
at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196)
at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:562)
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:796)
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:677)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:389)
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:676)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:835) Caused by: java.lang.NoClassDefFoundError: com/sun/tools/javac/file/BaseFileObject
at org.jetbrains.kotlin.kapt3.base.javac.KaptJavaFileManager.shouldBeFiltered(KaptJavaFileManager.kt:69)
at org.jetbrains.kotlin.kapt3.base.javac.KaptJavaFileManager.list(KaptJavaFileManager.kt:49)
at jdk.compiler/com.sun.tools.javac.code.ClassFinder.list(ClassFinder.java:737)
at jdk.compiler/com.sun.tools.javac.code.ClassFinder.scanUserPaths(ClassFinder.java:674)
at jdk.compiler/com.sun.tools.javac.code.ClassFinder.fillIn(ClassFinder.java:554)
at jdk.compiler/com.sun.tools.javac.code.ClassFinder.complete(ClassFinder.java:299)
at jdk.compiler/com.sun.tools.javac.code.Symbol.complete(Symbol.java:642)
at jdk.compiler/com.sun.tools.javac.code.Symbol$PackageSymbol.members(Symbol.java:1131)
at jdk.compiler/com.sun.tools.javac.code.Symtab.listPackageModules(Symtab.java:834)
at jdk.compiler/com.sun.tools.javac.comp.Enter.visitTopLevel(Enter.java:345)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCCompilationUnit.accept(JCTree.java:535)
at jdk.compiler/com.sun.tools.javac.comp.Enter.classEnter(Enter.java:286)
at jdk.compiler/com.sun.tools.javac.comp.Enter.classEnter(Enter.java:301)
at jdk.compiler/com.sun.tools.javac.comp.Enter.complete(Enter.java:577)
at jdk.compiler/com.sun.tools.javac.comp.Enter.main(Enter.java:561)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.enterTrees(JavaCompiler.java:1066)
at org.jetbrains.kotlin.kapt3.base.AnnotationProcessingKt.doAnnotationProcessing(annotationProcessing.kt:66)
at org.jetbrains.kotlin.kapt3.base.AnnotationProcessingKt.doAnnotationProcessing$default(annotationProcessing.kt:35)
at org.jetbrains.kotlin.kapt3.AbstractKapt3Extension.runAnnotationProcessing(Kapt3Extension.kt:230)
at org.jetbrains.kotlin.kapt3.AbstractKapt3Extension.analysisCompleted(Kapt3Extension.kt:188)
at org.jetbrains.kotlin.kapt3.ClasspathBasedKapt3Extension.analysisCompleted(Kapt3Extension.kt:99)
at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM$analyzeFilesWithJavaIntegration$2.invoke(TopDownAnalyzerFacadeForJVM.kt:96)
at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration(TopDownAnalyzerFacadeForJVM.kt:106)
at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration$default(TopDownAnalyzerFacadeForJVM.kt:81)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler$analyze$1.invoke(KotlinToJVMBytecodeCompiler.kt:555)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler$analyze$1.invoke(KotlinToJVMBytecodeCompiler.kt:82)
at org.jetbrains.kotlin.cli.common.messages.AnalyzerWithCompilerReport.analyzeAndReport(AnalyzerWithCompilerReport.kt:107)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.analyze(KotlinToJVMBytecodeCompiler.kt:546)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules$cli(KotlinToJVMBytecodeCompiler.kt:177)
... 23 more Caused by: java.lang.ClassNotFoundException: com.sun.tools.javac.file.BaseFileObject
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:436)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 52 more
Does anyone experience a similar behaviour when running Android Projects on Java 11/12/13?
I had a similar issue recently regarding to JDK9.
I used this library which solved the problem:
"com.github.pengrad:jdk9-deps:1.0"
Unfortunately, this is due to the lacking support of JDK 13 in Gradle 5.x.
Gradle 6.0 will support Java 13 (https://docs.gradle.org/6.0/release-notes.html).
Until then, there's no other possibility than waiting.

Error occurred during initialization of VM from a remote debian VM

I know my question is related to some others, but the answers I found don't work for me. That's my problem: I have to run a JAVA script on a remote debian VM (from bash). When I run the program I get this:
Error occurred during initialization of VM
java.lang.Error: java.lang.ClassNotFoundException: org.processmining.framework.util.ProMClassLoader
at java.lang.ClassLoader.initSystemClassLoader(ClassLoader.java:1469)
at java.lang.ClassLoader.getSystemClassLoader(ClassLoader.java:1436)
Caused by: java.lang.ClassNotFoundException: org.processmining.framework.util.ProMClassLoader
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at java.lang.SystemClassLoaderAction.run(ClassLoader.java:2209)
at java.lang.SystemClassLoaderAction.run(ClassLoader.java:2195)
at java.security.AccessController.doPrivileged(Native Method)
at java.lang.ClassLoader.initSystemClassLoader(ClassLoader.java:1456)
at java.lang.ClassLoader.getSystemClassLoader(ClassLoader.java:1436)
As seen on stackoverflow, I already tried different display options, like
export DISPLAY=:0.0
setenv DISPLAY :0.0
unset DISPLAY
and some others, but unsuccessfully.
I suspect a GUI problem on my debian VM. An idea ?

How to run ControlsFX sample application using Java 11 and JavaFX 11

ControlsFX website says:
If you want to play with the ControlsFX sample application, simply
download the ControlsFX release and run the following command on the
command prompt (be sure to replace the * with the actual version
number of FXSampler and ControlsFX-samples):
java -jar controlsfx-samples-*.jar
I've downloaded ControlsFX 9.0.0 which is said to be for users of Java 9 and later.
When I run java -jar controlsfx-samples-9.0.0.jar I get
Error: Could not find or load main class fxsampler.FXSampler
Caused by: java.lang.NoClassDefFoundError: javafx/application/Application
But that's OK, as according to Run HelloWorld using JavaFX 11 guide, I have to add modules.
So I try java --module-path "C:\Program Files\Java\javafx-sdk-11\lib" --add-modules=javafx.controls -jar controlsfx-samples-9.0.0.jar and I get
Missing JavaFX application class fxsampler.FXSampler
I execute all commands from controlsfx-9.0.0 directory which contains controlsfx-9.0.0.jar, controlsfx-samples-9.0.0.jar and fxsampler-1.0.10.jar.
Output of java -version for me is:
openjdk version "11.0.1" 2018-10-16
OpenJDK Runtime Environment 18.9 (build 11.0.1+13)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.1+13, mixed mode)
Any comments and suggestions are appreciated.
Thanks in advance.
EDIT:
After following Slaw's advice and running java --module-path "C:\Program Files\Java\javafx-sdk-11\lib" --add-modules=javafx.controls,javafx.fxml,javafx.web -jar controlsfx-samples-9.0.0.jar I get
Initialising FXSampler sample scanner...
Discovering projects...
Found project 'ControlsFX', with sample base package 'org.controlsfx.samples'
Exception in Application start method
java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:464)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:363)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at java.base/sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:1051)
Caused by: java.lang.RuntimeException: Exception in Application start method
at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:900)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:195)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.NoClassDefFoundError: Could not initialize class impl.org.controlsfx.version.VersionChecker
at org.controlsfx.control.ControlsFXControl.(ControlsFXControl.java:35)
at org.controlsfx.control.WorldMapView.(WorldMapView.java:93)
at org.controlsfx.samples.HelloWorldMapView.(HelloWorldMapView.java:55)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
at java.base/java.lang.Class.newInstance(Class.java:584)
at fxsampler.util.SampleScanner.discoverSamples(SampleScanner.java:86)
at fxsampler.FXSampler.start(FXSampler.java:106)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:846)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:455)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427)
at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
... 1 more
Exception running application fxsampler.FXSampler
Fixed in PR #720. So new Maven artifacts will incorporate the fix.
Full issue history can be seen here.

Code running in Netbeans but not in command line

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
Try this:
-cp "../bin/Test.jar:lib/*:." instead of your:
-cp ../bin:.

Categories

Resources