Solved

Running a JAR file in windows cmd.

Posted on 2004-09-21
3
687 Views
Last Modified: 2013-12-11
I have use WSAD 5.0 to export a jar file with main class.

When i try to use my windows cmd promt to run the jar file with the following command:

java -jar e:\myjar.jar

it can success run the main class, but when it is trying to access the class within ANOTHER jar file included in myjar.jar lib folder, I got a NoClassDefFoundError for that class.

How can I solve it?

Thanks.
0
Comment
Question by:nkan
  • 2
3 Comments
 
LVL 14

Expert Comment

by:boonleng
ID: 12120837
You can put a jar file inside another jar file.

Place it outside the jar file, then set the classpath in the Manifest.mf e.g.
Manifest-Version: 1.0
Main-Class: com.test.MainClass
Class-Path: another.jar

Or place the classpath during execution
java -classpath another.jar -jar myjar.jar
0
 
LVL 14

Accepted Solution

by:
boonleng earned 50 total points
ID: 12120865
opps..
should be You cant put a jar file inside another jar file.
0
 
LVL 5

Expert Comment

by:apparition
ID: 12184664
Try

java -cp one.jar;myjar.jar
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

757 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

22 Experts available now in Live!

Get 1:1 Help Now