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 21, 2019 in Java by cloakd
• 120 points
3,213 views
Please mention the command you are using to execute the jar file.

2 answers to this question.

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. 

answered Apr 23, 2019 by Omkar
• 69,220 points
0 votes
Check out the answer here.
answered Apr 23, 2020 by Anonymous

Related Questions In Java

+3 votes
13 answers

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

add a jar/manifest/attributes setting like this: apply plugin: ...READ MORE

answered Nov 27, 2018 in Java by krishti
216,442 views
0 votes
1 answer

Can't execute jar- file: “no main manifest attribute”

First, it's kind of weird, to see ...READ MORE

answered Dec 23, 2020 in Java by Gitika
• 65,770 points
2,662 views
+5 votes
11 answers

How to import a jar file in Eclipse?

Click on File > Import. The Import ...READ MORE

answered Aug 23, 2018 in Java by Daisy
• 8,140 points
359,822 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 Parth
• 4,640 points
7,424 views
+5 votes
4 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,450 points

edited Nov 7, 2018 by Omkar 81,240 views
+1 vote
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,500 points
8,363 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,500 points
17,438 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,500 points

edited Aug 4, 2023 by Khan Sarfaraz 4,880 views
0 votes
1 answer

Unable to Run the .java file

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

answered Jan 11, 2019 in Java by Omkar
• 69,220 points
796 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 22, 2019 in Java by Omkar
• 69,220 points
2,626 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP