The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
December 2001



This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.


Jar files

Posted by Chris Mitchell on December 05, 2001 at 6:35 AM

I have created a simple java problem that prints the date. The method of getting the date is do by referencing a class from an external jar file. The program works fine. I thought I would try to put the file in a Jar file. I archived the file using this as the manifest:

Main-Class: test_jar
Class-Path: G:\Data\Java_Dev\Generic_Classes\bytron.jar

test_jar is the name of the entry class (and only class in the jar file).
bytron.jar is the jar file which contains the date method which is used by the program.

The jar file is created with no problems.

When I try to run the jar file i get an error.

Running: java -jar test.jar

Generates this error:
Exception in thread "main" java.lang.NoClassDefFoundError: test_jar

I have tried adding test.jar to the class path, aswell as '.' .

I understand that the error is telling me that it cannot find the entry class. I am guessing this is because I have stated a classpath. But how do I tell it to look at its self as well as externally.

This is driving me mad. Can anyone help, please!!!

  • jar in a jar Chin Loong December 05, 2001 at 3:08 PM (2)
    • Jars Chris Mitchell December 06, 2001 at 4:37 AM (1)
      • ah? Chin Loong December 06, 2001 at 5:34 AM (0)

Sponsored Links

Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us