Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Jar manifest problem

 
Hugh O'Donnell
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it possible to run a jar file that is contained within another jar file? I have tried and can't seem to get it to work.
I have the following manifest in test.jar :

Manifest-Version: 1.0
Main-Class: com.efinery.RunTest

This runs fine using "java -jar test.jar" from the command line. However, when I place it inside a jar called mainapp.jar and have it's manifest reference test.jar in the Classpath as follows :

Manifest-Version: 1.0
Main-Class: com.efinery.RunTest
Classpath: test.jar

When I try to run "java -jar mainapp.jar" I get a java.lang.NoClassDefFoundError. Can anybody tell me what I am doing wrong? Any help would be much appreciated.
 
Stefan Wagner
Ranch Hand
Posts: 1923
Linux Postgres Database Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is diskussed nearby: here
 
Marilyn de Queiroz
Sheriff
Posts: 9059
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you running from the directory that the jar is stored in?
 
Hugh O'Donnell
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the help guys, but unfortunately still no luck.
I did try as you suggested Stefan, using the following manifest in mainapp.jar :

Main-Class: com.efinery.RunTest
Class-Path: test.jar .
<a blank line here>

Marilyn, as you asked, you I am running from the directory that contains the jar. Also in the same directory is the original test.jar that is also inside mainapp.jar. I should say that mainapp.jar contains no java code, only some documentation and source code. I simply want the mainfest in mainapp.jar to run the manifest in the nested test.jar.
 
Marilyn de Queiroz
Sheriff
Posts: 9059
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It sounds like you are trying to display the manifest. I think that will never happen. What if you put the text as a constant String inside a class in the jar and do a System.out.println() on it, jar it, and then run it.
 
Stefan Wagner
Ranch Hand
Posts: 1923
Linux Postgres Database Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Hugh O'Donnell:
Thanks for the help guys, but unfortunately still no luck.
I did try as you suggested Stefan, using the following manifest in mainapp.jar : ...



I had to correct myself there (and did it) on July 30, 2004 05:40 PM.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic