Solved

Problem to run jar file

Posted on 2015-02-11
4
149 Views
Last Modified: 2015-02-11
Hi,
I can directly run the project fine, within Eclipse. But when I run it like

Z:\cmp2\Eclipse\JLib4>java -jar BankAcctNoValidator_049.jar
no main manifest attribute, in BankAcctNoValidator_049.jar

Open in new window

using the exported Jar, I get the problem in above. How to run the jar file?
0
Comment
Question by:HuaMinChen
  • 2
4 Comments
 
LVL 10

Author Comment

by:HuaMinChen
ID: 40602663
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 40602717
There's no Main-Class attribute in the manifest. You didn't export it properly

http://home.technojeeves.com/webtmp/BankAcctNoValidator_049.jar
0
 
LVL 10

Author Comment

by:HuaMinChen
ID: 40602811
Sorry, can I have the details to add Main-Class attribute? Thanks.
0
 
LVL 1

Accepted Solution

by:
Ali Can Albayrak earned 500 total points
ID: 40602880
I guess you export it by choosing JAR FILE instead of RUNNABLE JAR configuration. If you export as a runnable jar, eclipse's export dialog will ask you where your main class is. Then it generates MANIFEST.MD file for you.
In MANIFEST.MD file, main class should be pointed.
Something like int the following:

Manifest-Version: 1.0
Class-Path: .
Main-Class: com.hkicl.ecp.hkanvm.b049.BankAcctNoValidator
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
diffSum example 4 37
tomcat not starting 6 45
arguments to jar 5 26
eclipse console opening separately 2 21
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
The viewer will learn how to implement Singleton Design Pattern in Java.

773 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