Unable to execute jar- file: “no main manifest attribute”

0 votes
I am trying to create a jar file through the terminal instead of using eclipse.

The only problem im running into, is that once i have created the jar file and i try to run it, i received the message “no main manifest attribute”.

I have a main in one of my .jar files.

I have tried making my own manifest file, but im not sure how to.
Apr 20 in Java by cloakd
• 120 points
63 views
Please mention the command you are using to execute the jar file.

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

The proper syntax to run a jar file is as follows:

$ java -jar filename.jar

If you are as facing the same error after trying the above command then try passing the package and classname with the command, something like this:

$ java -cp filename.jar com.packagename.classname

And even if this doesn't work then I think you have not created an executable jar file. Refer to this link to know how to create an executable jar.

answered Apr 22 by Omkar
• 65,850 points

Related Questions In Java

+1 vote
10 answers

Unable to execute jar- file: “no main manifest attribute”

You Can Simply follow this step Create ...READ MORE

answered Dec 10, 2018 in Java by Sukesh
9,807 views
0 votes
10 answers

How to import a jar file in Eclipse?

Go to your project right click and ...READ MORE

answered Dec 10, 2018 in Java by Hola77
19,259 views
0 votes
1 answer

How to run a JAR file in Java?

The command given below will help you ...READ MORE

answered Jun 1, 2018 in Java by parth295
• 4,590 points
170 views
0 votes
1 answer

How can we add local .jar file dependency to build.gradle file?

You can refer the below code if ...READ MORE

answered Jun 27, 2018 in Java by Akrati
• 960 points
762 views
+5 votes
3 answers

How to execute a python file with few arguments in java?

You can use Java Runtime.exec() to run python script, ...READ MORE

answered Mar 27, 2018 in Java by DragonLord999
• 8,360 points

edited Nov 6, 2018 by Omkar 4,525 views
0 votes
1 answer

How to handle drop downs using Selenium WebDriver in Java

First, find an XPath which will return ...READ MORE

answered Mar 27, 2018 in Selenium by nsv999
• 5,030 points
1,214 views
0 votes
1 answer

What are the differences between getText() and getAttribute() functions in Selenium WebDriver?

See, both are used to retrieve something ...READ MORE

answered Apr 5, 2018 in Selenium by nsv999
• 5,030 points
3,487 views
0 votes
1 answer

Selenium JARS(Java) missing from downloadable link

Nothing to worry about here. In the ...READ MORE

answered Apr 5, 2018 in Selenium by nsv999
• 5,030 points
216 views
+1 vote
1 answer

Unable to Run the .java file

You have to enter the commands as ...READ MORE

answered Jan 10 in Java by Omkar
• 65,850 points
30 views
0 votes
2 answers

What is the meaning of purpose of this command: java -jar <some jar file>.jar ?

JAR (Java Archive) file is a package file ...READ MORE

answered Mar 21 in Java by Omkar
• 65,850 points
25 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.