Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

run the jar file created from windows in linux as executable

Hi I have developed a swing application using javafx on Windows operating system . It's working fine on Windows. But when I run the jar on Linux it's defaulting to opening in the archive manager, it's not working as an executable.

I have checked the properties of the jar file, it's an executable already.

Do I have to recompile the source file in a Linux environment to run this jar file on Linux or will the jar file work on Linux also?

like image 278
adesh singh Avatar asked Feb 17 '23 17:02

adesh singh


1 Answers

If you've not used an operating system dependent commands like running a windows command from java (which will not run in linux for sure) or using a windows specific module, your java will run in all other operating systems. This is one of the most significant features of java which is cross-platform and you can run your code in different operating systems which has that operating system specific java runtime environment installed.

So in all operating systems, just you have to run

java -jar yourjarfile.jar
like image 80
Vahid Farahmand Avatar answered Feb 20 '23 07:02

Vahid Farahmand