Jar | Community
Skip to main content
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by MayurSatav

hi @anantharamulu_g ,

You can convert a regular JAR file into an executable JAR file by following these steps:

1. Create a file named MANIFEST.MF in the same directory as your JAR file. Add the following contents to the file:

 

Manifest-Version: 1.0 Main-Class: com.example.MainClass​

 

 

 

2. Open a command prompt or terminal window.Navigate to the directory containing your JAR file and the MANIFEST.MF file and Run the following command:

 

jar cfm myapp.jar MANIFEST.MF com/example/*.class

 

 

 

3. To test the executable JAR file, Run the following command to start your application:

 

java -jar myapp.jar

 

 

 

3 replies

Anudeep_Garnepudi
New Participant
May 5, 2023

@anantharamulu_g 

Try 

Right-click the .jar file >> click Properties >> In the general tab, click Change besides open with: >> click More Apps >> scroll down, click Look for another app on the PC >> browse to Java installation directory > bin > select  "javaw"

nitesh_kumar-1
Employee
May 4, 2023

Hi @anantharamulu_g ,

 

I think you are facing some issues with opening this JAR, it is executable by default. the problem here seems to be here ".jar" in your filename. Could you try after removing it? 

I have seen this problem on Windows, where sometimes adding an extension makes it unusable. (Check you view setting of windows).

 

Also, try to open this file using the command prompt using

java -jar <youraemjar>

 

Hope this helps!

 

Regards,

Nitesh

MayurSatav
MayurSatavAccepted solution
New Participant
May 4, 2023

hi @anantharamulu_g ,

You can convert a regular JAR file into an executable JAR file by following these steps:

1. Create a file named MANIFEST.MF in the same directory as your JAR file. Add the following contents to the file:

 

Manifest-Version: 1.0 Main-Class: com.example.MainClass​

 

 

 

2. Open a command prompt or terminal window.Navigate to the directory containing your JAR file and the MANIFEST.MF file and Run the following command:

 

jar cfm myapp.jar MANIFEST.MF com/example/*.class

 

 

 

3. To test the executable JAR file, Run the following command to start your application:

 

java -jar myapp.jar