I have tried the example as the same as written as answer from this link'How to create a .jar file using the terminal' to create a jar file from command prompt. But I am getting an error 'no main manifest attribute , in Helloworld.jar'
. What will be the problem? Please help.I done the same as explained in that method.
Asked
Active
Viewed 90 times
0

Community
- 1
- 1

androidGenX
- 1,108
- 3
- 18
- 44
-
How are you building your project ? Is it maven ? – StackFlowed Oct 17 '14 at 14:01
-
@wrongAnswer I am building my project from simple way no IDEs used!! – androidGenX Oct 17 '14 at 14:02
-
1I strongly suspect you *haven't* done exactly the same thing. What does your manifest file look like before jarring? If you extract the jar file, what does the manifest from it look like? – Jon Skeet Oct 17 '14 at 14:02
-
@JonSkeet manifest file looks like Main-Class: HelloWorld – androidGenX Oct 17 '14 at 14:03
-
Does the class HelloWorld exist in the source you're compiling? – C. Ross Oct 17 '14 at 14:03
-
And has that successfully been included in the jar file? (This is all information that should be in your question.) – Jon Skeet Oct 17 '14 at 14:03
-
@C.Ross it is in the same directory – androidGenX Oct 17 '14 at 14:05
-
@JonSkeet my question is when I do the step 'java -jar HelloWorld.jar' I am getting 'no main manifest attribute , in Helloworld.jar', instead of printing my result – androidGenX Oct 17 '14 at 14:06
-
1and the manifest file is ended by a new line? This is important. – Plux Oct 17 '14 at 14:10
-
We're *trying* to help, but you're not giving us the information that we've asked for. – Jon Skeet Oct 17 '14 at 14:14
-
try editing your question tell the procedure how you created the jar and necessary information like if it contains some package definition if it contains some other class definition – SparkOn Oct 17 '14 at 15:07
1 Answers
0
Solved it using instead 'jar cfe HelloWorld.jar HelloWorld HelloWorld.class' of 'jar cfm HelloWorld.jar Manifest.txt HelloWorld.class'. Thanks guys!!

androidGenX
- 1,108
- 3
- 18
- 44