Java Application not opening on Ubuntu but opening on windows - jar

Hi I have java desktop application developed by myself which uses external jar files. When i open it on windows it opens successfully but on Ubuntu 14.04 it fails with exception.
Windows:
java -cp bin;lib\thinlet.jar;lib\xercesImpl.jar;lib\xml-apis.jar;lib\commons-cli-1.0.jar;lib\jsyntaxpane-0.9.5-b29.jar;lib com.macpropeditor.propedit.ApplicationRunner
Ubuntu:
java -cp bin:lib\thinlet.jar:lib\xercesImpl.jar:lib\xml-apis.jar:lib\commons-cli-1.0.jar:lib\jsyntaxpane-0.9.5-b29.jar:lib com.macpropeditor.propedit.ApplicationRunner
On ubuntu I am getting below error:
abc#abc-virtual-machine:~/MACPropEditor$ java -cp bin:lib\thinlet.jar:lib\xml-apis.jar:lib\xercesImpl.0.jar:lib\jsyntaxpane-0.9.5-b29.jar:lib com.macpropeditor.propedit.ApplicationRunner
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/cli/ParseException
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2570)
at java.lang.Class.getMethod0(Class.java:2813)
at java.lang.Class.getMethod(Class.java:1663)
at sun.launcher.LauncherHelper.getMainMethod(LauncherHelper.java:494)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:486)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.cli.ParseException
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
Is there anything i need to set on Ubuntu? Please suggest.
All jars present in 'lib' directory.
Java version windows:
java version "1.6.0_27"
Java(TM) SE Runtime Environment (build 1.6.0_27-b07)
Java HotSpot(TM) Client VM (build 20.2-b06, mixed mode, sharing)
Java version Ubuntu:
java version "1.7.0_65"
OpenJDK Runtime Environment (IcedTea 2.5.2) (7u65-2.5.2-3~14.04)
OpenJDK Server VM (build 24.65-b04, mixed mode)
Programm is compliled on windows machine and deployed on ubuntu as well.

I'm betting it's due to different Java versions. Java on Ubuntu is not recognizing the class(es) because they are compiled using a later version of Java (eg Java 8, but running with Java 7).
Check your java version in both cases using java -version.

Problem is resolved:
I was using '\' instead of '/' on ubuntu.
So the below cmd is working:
java -cp bin:lib/commons-cli-1.0.jar:lib/thinlet.jar:lib/xercesImpl.jar:lib/xml-apis.jar:lib/jsyntaxpane-0.9.5-b29.jar:lib com.macpropeditor.propedit.ApplicationRunner

Related

The specified folder does not contain a Java platform

I am using Apache NetBeans IDE 11.0 (Build incubator-netbeans-release-404-on-20190319) and Java: 11.0.6; OpenJDK 64-Bit Server VM 11.0.6+10-post-Ubuntu-1ubuntu118.04.1
Runtime: OpenJDK Runtime Environment 11.0.6+10-post-Ubuntu-1ubuntu118.04.1
System: Linux version 4.15.0-30-generic running on amd64; UTF-8; en_CA (nb)
If I try to creant a JavaFX project I get : Failed to automatically set-up a JavaFX Platform.

Installing nexus error: The version of the JVM must be at least 1.8 and at most 1.8

I have installed Nexus on Ubuntu 18.04 LTS. When I want to start Nexus service I get this error:
nexus[24049]: No suitable Java Virtual Machine could be found on your system.
nexus[24049]: The version of the JVM must be at least 1.8 and at most 1.8.
nexus[24049]: Please define INSTALL4J_JAVA_HOME to point to a suitable JVM.
systemd[1]: nexus.service: Control process exited, code=exited status=83
systemd[1]: nexus.service: Failed with result 'exit-code'.
systemd[1]: Failed to start LSB: nexus.
I have Open JDK version 10.0.2 installed in my system:
openjdk version "10.0.2" 2018-07-17
OpenJDK Runtime Environment (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.4)
OpenJDK 64-Bit Server VM (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.4, mixed mode)
My question is why Nexus uses ONLY JDK8? and am I able to have both JDK versions alongside?
INSTALL4J_JAVA_HOME is not an environment variable setting. It is configured in the nexus installation directory. You'll need to edit "/bin/nexus" file.
You'll find near the top of that configuration script a commented out line:
# INSTALL4J_JAVA_HOME_OVERRIDE=
remove the comment tag and set the value to your jdk location. I set mine to a java 1.8 jdk that I installed. (Not the JDK 11.0.4 default dir that some linux installations are prepackaged with. I read somewhere that you must use the Java 1.8 with nexus version 3.x and that other versions will fail. I don't know the truth to that claim, you certainly can try other version to see if they work.)
After doing that, the nexus service was able to start.
I still haven't been able to get access to the nexus manager through a browser via port 8082. I'm just now trying to track that issue down. Probably a configuration issue or something else I need to set up.

8u66 Windows 64-bit packager - install succeeds but application fails to start

My JavaFX Application is installed correctly in Windows 8 (64 bit) but refuses to run !
I use the JavaFX native packager to produce native install bundles for Windows (from an Eclipse / Ant script).
I create my Windows bundle from a 64-bit Windows 7 build machine - JDK used
: 8u66 b02 early access - 64-bit Windows.
Unfortunately there is no logs generated by Windows ! So it's difficult to know the cause of the crash.
For information this is the list of DLL installed :
MSVCP120.dll
MSVCR100.dll
MSVCR120.dll
My problem is similar to this issue (Java Bug system) : https://bugs.openjdk.java.net/browse/JDK-8131321
But this bug normally was fixed !
Any ideas ?

JavaFX NoClassDefFoundError

I have installed JDK 8 a bit ago, to use the WebView, but I got an error. The error was this:
Exception in thread "main" java.lang.NoClassDefFoundError:
javafx/embed/swing/JFXPanel
I don't know why the Swing isn't embed into JavaFX for JDK 8, but anyone know how to fix this?
[ java -version output ]
java version "1.8.0_11"
Java(TM) SE Runtime Environment (build 1.8.0_11-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.11-b03, mixed mode)
Question is solved, I just needed to check in the Run Configuration that the right JRE was used.
Another question. It said the "source isn't attached" (I think the jfxrt.jar is not there where its supposed to be.) Any suggestions?
My guess is that you think you are using Oracle Java 8, but you aren't really and are using Java 7 instead or you are using an OpenJDK Linux version which does not have JavaFX. Run java -version and edit your question to include the output.

Unable to run Javafx from computer by double clicking the jar file

I have created a JavaFx application using Netbeans. It is running fine, if I run the application from Netbeans.But, if I double click the jar file, I am getting error message as
JavaFx 2.1.0 is required to view this content but JavaFx. Get the JavaFx runtime from javafx.com/javafx and run the installer. Then restart the application
But I already have JavaFX runtime installed in my PC. But, if I run the jar file from command line as java -jar MyJavaFxApplication.jar, then it is running properly.
My question is somehow similar to the question "Unable to run JavaFx Jar with JRE7". But that question still unanswered.
My Java version is :
java version "1.7.0_05"
Java(TM) SE Runtime Environment (build 1.7.0_05-b05)
Java HotSpot(TM) 64-Bit Server VM (build 23.1-b03, mixed mode)
Thanks in advance.
If you use NetBeans 8 or JDK 1.8 you have to run the file using Java 8.
If Java 8 is installed on your system and it should be a bundle with NetBeans just point it to your JAVA PATH from Computer Properties Variables.

Resources