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
138 views
Please mention the command you are using to execute the jar file.

1 answer 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. Refer to this link to know how to create an executable jar.

answered Apr 22 by Omkar
• 67,160 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
15,724 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
33,062 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,600 points
335 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
1,027 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,380 points

edited Nov 6, 2018 by Omkar 6,225 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,050 points
1,639 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,050 points
4,346 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,050 points
338 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
• 67,160 points
34 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
• 67,160 points
32 views