Error occurred during initialization of VM from a remote debian VM - java

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 ?

Related

eclipse does not start - wrong eclipse.ini?

I just installed the official eclipse photon version via oomph-installer on an ubuntu-64 bit machine on a vm workstation.
Unfortunately it does not start, giving me this exception:
java.lang.ClassNotFoundException: org.eclipse.core.runtime.adaptor.EclipseStarter
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:626)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584)
at org.eclipse.equinox.launcher.Main.run(Main.java:1438)
at org.eclipse.equinox.launcher.Main.main(Main.java:1414)
I inspected the eclipse.ini and found that on startup these two files are needed:
lugins/org.eclipse.equinox.launcher_1.3.0.dist.jar
plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.200.dist
But they are not present in the actual plugins directory (/usr/share/eclipse/plugins). Are these files missing or are other files needed on startup?

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:.

Raspberry pi - java - Serial Com

I've got a serious problem with my Raspberry Pi (OS: Raspbian) and Java (JDK-7-Armhf). My code wont execute without creating a Exception.
I'll been reading and trying several proposals and nothing have worked yet.
So now i am confused of what went wrong..?
So it goes like this:
I've got a Java source code that will run in my Eclipes IDE.
But when i export the .jar-file, even with library (JRE System lib. _86, JavaSE1.7, JAVAX.comm), as "Runnabel JAR" or just .JAR and execute it om my Raspberry pi, i've got "NoCLassDefFoundExecption: SerialPortEventListener..!
I just don't know why, it won't find the library and use it..!
On my Pi i have librxtx-java installed and JDK-7-oracle-armhf.
librxtx-java should be setting its JAVA_PATH on it's own when installed, but not sure that is done correct!
(I've got a folder /usr/jni and it contains: librxtxSerial.so and
/usr/lib/jvm/jdk-7-oracle-armhf/).
Looking at the library Javax.RXTXcomm in Eclipse, i've got RXTXcomm.jar, that contains SerialPortEventListener, so it is defininated i the .jar.
I'm thinking about, could it be, that there is a missing link between my Java JVM and linux serialport driver? My JRE is working in some way, because it will execute a code to readout HOSTNAME & IP-Adress.
So is there some one who knows how to fix this..?
This is a readout of Java Exception:
Exception in thread "main" java.lang.NoClassDefFoundError: javax/comm/SerialPortEventListener
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:792)
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:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)
Caused by: java.lang.ClassNotFoundException: javax.comm.SerialPortEventListener
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
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:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 13 more
A copy of my code. "SimpleRead.java" The original from java comm API samples
You have to change the reference from javax.comm to gnu.io in your source code.
Try following:
Switch to root and run the program you created
If that helps do following
sudo adduser username dialout
then log out and log in from all terminals and GUIs

Conflict between MySQL and mail Java libraries

I have a problem with Java libraries. I'm using javax.mail and mysql-connector.
While compiling I don't have any problems, but if I try to execute the program with sudo:
$sudo java Server -jar mysql-connector-java-5.1.28.jar
It gives me this error:
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:259)
at dbConnect.dbQuery(dbConnect.java:192)
at Server.main(Server.java:39)
while if I try to execute it without sudo:
$java Server -jar mysql-connector-java-5.1.28.jar
It gives me this error:
Exception in thread "main" java.lang.NoClassDefFoundError: javax/mail/internet/AddressException
at dbConnect.registration(dbConnect.java:161)
at dbConnect.splitUsrPass(dbConnect.java:87)
at dbConnect.dbQuery(dbConnect.java:196)
at Server.main(Server.java:39)
Caused by: java.lang.ClassNotFoundException: javax.mail.internet.AddressException
at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 4 more
I can understand why it doesn't work without administrator privileges (I guess the mail library requires them) but it seems strange to me that it won't find the MySQL library if I give it the administrator privileges.
Does anyone know if this is a known issue?
When you want to run something with Java on the command line, you have two options:
Run a class: java MyClass
Run a jar: java -jar MyJar.jar
What you are trying to do is both, which will result in the -jar-part will be ignored.
I'm guessing that what you want to do is run the class Server, with the MySQL-jar on the classpath. The correct command will then be:
java Server -cp mysql-connector-java-5.1.28.jar
You could also add the directory containing the MySQL-jar to the CLASSPATH environment variable. The reason you get different error messages when using sudo and not is probably because the root user has a different CLASSPATH than your user (your user lacks the javax.mail-jar on the classpath, while root has it.)

To use Android Studio encountered an error

I have Android Studio (Google I/O Preview).
I created an android project in Android Studio, and when I run it, the Studio tell me :
/usr/lib/jvm/java-1.7.0-openjdk-amd64/bin/java -ea -Didea.launcher.port=7534 -Didea.launcher.bin.path=/home/username/android-studio/bin -Dfile.encoding=UTF-8 -classpath /home/username/android-studio/lib/idea_rt.jar:/home/username/android-studio/plugins/junit/lib/junit-rt.jar:/home/username/android-studio/sdk/platforms/android-17/android.jar:/home/username/android-studio/sdk/platforms/android-17/data/res:/home/username/android-studio/sdk/tools/support/annotations.jar:/home/username/AndroidStudioProjects/test/test/libs/android-support-v4.jar com.intellij.rt.execution.application.AppMain com.intellij.rt.execution.junit.JUnitStarter -ideVersion5 #/tmp/idea_junit6666593680737984739.tmp -socket52225
Exception in thread "main" java.lang.NoClassDefFoundError: junit/textui/ResultPrinter
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:188)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:113)
Caused by: java.lang.ClassNotFoundException: junit.textui.ResultPrinter
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
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:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
... 3 more
Process finished with exit code 1
What can I try?I've Googled this but haven't had much luck.
I don't know.When I use the Windows Version, I didn't meet any error;
Sounds like to me from your windows version has the missing class while your Linux Version does not.
Caused by: java.lang.ClassNotFoundException: junit.textui.ResultPrinter
Make sure you have this class in your library or where ever you are calling it for.
Hope this helps or points you to the right direction.

Categories

Resources