Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Running a JAR file in windows cmd.

Posted on 2004-09-21
3
Medium Priority
?
719 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 150 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

Enroll in September's Course of the Month

This month’s featured course covers 16 hours of training in installation, management, and deployment of VMware vSphere virtualization environments. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

670 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