.jar files wont open

Viewed 154

When I double click on a .jar nothing happens. I was able to open them a week ago but now nothing.

Things I have tried so far:

  • reinstalling both JRE and JDK
  • Running jarfix.exe
  • creating a .bat file

.bat file
When I create a .bat file and put it in the same folder or when I try to open the .jar using CMD - as Administrator I get the same error.

This is my .bat file:

java -jar -debug <File Name>.jar  
pause

And this is my error message:

(I'll provide 3 examples of 3 different .jar files)
(1)

F:\Games\RSPS\Tools\Displee>java -jar -debug "model_editor_1.4.1.jar"  
Error: Could not find or load main class etc.Main  
Caused by: java.lang.NoClassDefFoundError: javafx/application/Application  

F:\Games\RSPS\Tools\Displee>pause  
Press any key to continue . . .  

(2)

F:\Games\RSPS\Tools\RSPSi\RSPSi>java -jar -debug Editor.jar  
Error: Could not find or load main class com.rspsi.LauncherWindow  
Caused by: java.lang.NoClassDefFoundError: javafx/application/Application  

F:\Games\RSPS\Tools\RSPSi\RSPSi>pause  
Press any key to continue . . .    

(3)

F:\Games\RSPS\Tools>java -jar -debug bsp-3.0.4.jar  
Error: Could not find or load main class io.nshusa.App  
Caused by: java.lang.NoClassDefFoundError: javafx/application/Application  

F:\Games\RSPS\Tools>pause  
Press any key to continue . . .  

CMD
When I open CMD and type

java -version 

I get this:

C:\WINDOWS\system32>java -version  
java version "17.0.1" 2021-10-19 LTS  
Java(TM) SE Runtime Environment (build 17.0.1+12-LTS-39)  
Java HotSpot(TM) 64-Bit Server VM (build 17.0.1+12-LTS-39, mixed mode, sharing)  

and when I type

ftype | find "jarfile"  

I get this:

C:\WINDOWS\system32>ftype | find "jarfile"  
jarfile="C:\Program Files\Java\jdk-17.0.1\bin\javaw.exe" -jar "%1" %*  

It seems as if everything should be working properly but unfortunately it is not and I don't know where to go from here which is why I turned to all of you. I just want to remind you that

  • all .jar files would open for me a week ago
  • no .jar files will open now
  • I have been using Eclipse and IntelliJ

image

1 Answers

@PhilFreihofner and @ElliottFrisch are right. the Java GUI of JavaFx is only included in Oracle JDK/JRE 8. After Java 8, programmers have to use the openjfx GUI library instead.

Related