Solved

Manifest Attribute Problem in JAR file

Posted on 2009-05-19
1
355 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
ID: 24427401
add:


Main-Class: temp.temp.temp.class1


0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
custom annotations 9 42
HTTPSessionBindingListernter not configured in deployment descriptor 2 65
reverse digits of a number using for loop 5 52
tomcat startup error 5 102
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
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 learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…

860 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