Solved

Manifest Attribute Problem in JAR file

Posted on 2009-05-19
1
350 Views
Last Modified: 2013-12-29
I have a source and corresponding  .class file in c:\temp\temp\temp

Tried to make a jar file out of the class file. It does make one but is not runnable using java -jar jarfile.jar command. I keep getting the error:

Failed to load Main-Class manifest attribute from class1.jar

What I have now done is that I created the jar file with the default manifest file. I also know the file must be ended with a newline, the last line should be blank etc.
However, I think I am failing at how to include information about the Main-Class attribute.

So, to keep things simple, I attached the default manifest file. Please guide me what and how to edit in that file so that I can run that jar from command line.

Thanks
1).Code for class1.java file in c:\temp\temp\temp
 

package temp.temp.temp;

public class class1{

public static void main(String[] args)

{    System.out.println("Hi");  }

}
 

2).Code for MANIFEST.MF:
 

Manifest-Version: 1.0

Created-By: 1.5.0_18 (Sun Microsystems Inc.)
 

Thanks
 

Roopesh

Open in new window

0
Comment
Question by:perfect_tranquility
1 Comment
 
LVL 92

Accepted Solution

by:
objects earned 500 total points
Comment Utility
add:


Main-Class: temp.temp.temp.class1


0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Enhanced For loop vs ForEach Loop 4 54
countAbc challenge 9 49
parentbit challenge 3 51
Error with Java/Cache JDBC Classpath 2 19
An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now