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

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.

Related

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 ?

Java Application not opening on Ubuntu but opening on windows

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

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.

javaFX helloworld jar cannot be ran on different platform

I am new to this JavaFX stuff and not sure if anyone knows what I did wrong. Here is the scenario:
On win 7, used netbeans 8 with jdk1.8.0_05 created a helloworld.jar
On win 7, java -jar helloworld.jar works fine
move the helloworld.jar to Redhat 5.8 and used the same version jdk1.8.0_05, java -jar helloworld.jar . and I see the following error
Graphics Device initialization failed for : es2, sw
Error initializing QuantumRenderer: no suitable pipeline found
Red Hat Enterprise Linux 5.8 is not a supported configuration for JavaFX in Java 8.
Red Hat Enterprise Linux 6.x (and some other Linux variants) is supported.
MidoriKid provides a procedure to allow JavaFX to be used on a Red Hat EL 5.x system in his answer to: running JavaFx jars on redhat 5.8. Note that although the procedure can be followed, it is recommended that you uses more recent RHEL system to run JavaFX in a supported configuration.

Registry Key '...' has value '1.7', but '1.6' is required. Java 1.7 is Installed and the Registry is Pointing to it

My development team recently was forced over to a remote development environment where we do not have full access to the servers. Before the change over we had a JAR that was running fine on Java 1.7 x64 along with JRE 7. When we moved over to the new server our JAR was running alright, but then one of the server admins "updated" our Java to an older version and uninstalled the one we were using. Don't ask me why, I don't know. I re-installed Java 1.7 and uninstalled 1.6 along with the JREs.
The following problem occurs at runtime, there are no build errors:
Registry key 'Software\JavaSoft\Java Runtime Environment\CurrentVersion'
has value '1.7', but '1.6' is required.
Error: could not find java.dll
Error: could not find Java SE Runtime Environment.
I've run the same JAR on my laptop with no issues. Both the server and my laptop have JDK 1.7 and JRE 7 in the respective %HOME% variables and system PATH. I've even reinstalled JRE 6 and placed it later in the system environment PATH variables with the same result.
I have also changed the registry back to look at 1.6 and it results in the following, which I looked up and it appears to be from having multiple Javas installed (leading back to my original problem):
Exception in thread "main" java.lang.UnsupportedClassVersionError: ... :
Unsupported major.minor version 51.0
I would appreciate any insight you all have as I have been looking over various forums but nothing seems to have exactly my problem. Also, this has happen on another server we are using as well. Thanks!
Update: No luck with recompiling the JAR to either 1.6 or 1.7 and matching the JDK. Also, why in the world would a newer version of Java break an older compiled version?
This happens when you somehow confused java itself. You are trying to run a java 6 VM where it found a JRE 7. It might show this problem even if you type in the command line just java or java -version in a misconfigured environment. The JAR is not the problem, except in the very unlikely case where the code in JAR is looking in the Windows Registry for that (which probably is not your case).
In my case, I had the java.exe, javaw.exe and javaws.exe from Java 6 in the Windows/System32 folder (don't know how it got to be there). The rest of the JDK and JRE where found in the PATH inside C:\Java\jdk_1.7.0\bin. Oops!
Just had the similar error when installing java 8 (jdk & jre) on a system already running Java 7.
Error: Registry key 'Software\JavaSoft\Java Runtime
Environment'\CurrentVersion' has value '1.8', but '1.7' is required.
Error: could not find java.dll Error: Could not find Java SE Runtime Environment.
My environment was set up correctly (Path & java_home correctly defined), but the problem arises from the way pre-8 Java installers worked, which is that they used to copy the three executables (java.exe, javaw.exe & javaws.exe) to the Windows system directory. These remain unless overwritten by a new pre-8 installation.
However the Java 8 installer instead creates symbolic links in a new directory, C:\ProgramData\Oracle\Java\javapath, pointing to the actual JRE 8 location.
This means that you'll actually run the old 7 exes but use the new 8 DLLs.
So, the solution is simply to delete the 3 Java exes, as above, from the windows system directory.
If you are running 32-bit Java on a 64-bit Windows, the exes would be in Windows\SysWOW64, otherwise in Windows\System32.
I've deleted java files at windows/system32 and I also have removed c:\ProgramData\Oracle\Java\javapath from the PATH variable, because there was 3 symlinks to java 1.8 files.
I had JDK 1.7 in the %JAVA_HOME% variable and java1.7/bin in the PATH.
PS1: My problem was between Java 1.7 and Java 1.8.
PS2: I can't add this as a comment to Victor's answer because I haven't enough points.
In the START menu type "regedit" to open the Registry editor
Go to "HKEY_LOCAL_MACHINE" on the left-hand side registry explorer/tree menu
Click "SOFTWARE" within the "HKEY_LOCAL_MACHINE" registries
Click "JavaSoft" within the "SOFTWARE" registries
Click "Java Runtime Environment" within the "JavaSoft" list of registries here you can see different versions of installed java
Click "Java Runtime Environment"- On right hand side you will get 4-5 rows . Please select "CurrentVersion" and right Click( select modify option) Change version to "1.7"
Now the magic has been completed
I don't know if anyone is still following this thread, but I recently had this issue when I tried to launch ActiveMQ 5.10 as a Windows service.
I didn't have a JAVA_HOME path set.
I had Java 6 and Java 7 installed, but the default version was v7. (ie if I opened a command window and types "java -version").
This is where the clue was - "java -version" returned "Java HotSpot(TM) 64-Bit Server VM (build 23.1-b03, mixed mode)" but I was had installed the Win32 service...
It turns out that if you use the Win32 wrapper on a 64-bit machine it somehow decides to use a different version of Java...
So my fix was to uninstall the 32-bit version of the wrapper and install the 64-bit version.
aversion on my machine; just habit I guess... But luckily I resolved the issue eventually...
For my Win7
Paradox was in being java.exe and javaw.exe in System32 folder.
Opening that folder I couldn't see them but using search in Start menu I get links to those files, removed them. Next searsh gave me links to files from JAVA_HOME
magic )
Change to directory with correct java.exe i.e. go to the required JDK version java.exe
cd C:/Program Files/Java/jdk1.7.0_25/bin
Run the java.exe from this directory, it has precedence over registry and $PATH settings.
java -jar C:/installed/selenium-server-standalone-2.53.0.jar
I solved this problem by uninstalling Java 1.8
The jar was compiled to be 1.6 compliant. That is why you get this error. Two resolutions:
1) Use Java 1.6
OR
2) Recompile the jar to be compliant for your environment 1.7
Using regedit, remove the entries corresponding to java 7. It will work.

Resources