Solved

Manifest Attribute Problem in JAR file

Posted on 2009-05-19
1
353 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
groupNoAdj 7 84
best (free) software to access postgres db (java) 1 32
Systems talking to each other 5 123
starter POM and spring-boot-starter,  spring-boot-web 2 40
INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

914 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

23 Experts available now in Live!

Get 1:1 Help Now