run the jar file created from windows in linux as executable

12,770

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
Share:
12,770
adesh singh
Author by

adesh singh

Application Programmer (Java , Python ) , Freelancer and Youtuber I publish programming related videos Link to my Youtube Channel: https://www.youtube.com/c/techyadesh

Updated on June 04, 2022

Comments

  • adesh singh
    adesh singh almost 2 years

    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?