Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how do I convert my java files into an application? [closed]

I coded up 4 .java files. The thing is that I can only execute my .java files from my IDE, how do I execute the .class files like an application? I study at uni, and I was told that Java is platform independent. Any tutorial/book recommendations would be highly appreciated.

Thanks

like image 696
Gaurav Dadhania Avatar asked Nov 28 '22 00:11

Gaurav Dadhania


2 Answers

The basic idea (to give you some things to search for) is:

  • Bundle your compiled .class files into a 'jar'.
  • Add a manifest to your jar specifying a main class to run.

You might find your IDE already creates this when you run a 'clean build'. Netbeans puts this into a 'dist' folder.

Modern JREs will allow you to run the jar by double clicking it etc.

You can also go a bit further by wrapping the jar in a native executable using a tool such as JSmooth.

like image 132
Cogsy Avatar answered Dec 06 '22 08:12

Cogsy


Look at executable jar. Here is the precise one, without any details, Creating executable jar files.

like image 40
Adeel Ansari Avatar answered Dec 06 '22 10:12

Adeel Ansari