• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Manifest Classpath problem

 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I have a ant script that creates a jar with the following dir structure

MyProject.jar
-lib (contains asm-all-2.1.jar)
-myPackageDir

How can i set the class-path to the asm-all-2.1.jar in the lib Directory?

 
Ranch Hand
Posts: 1953
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you set this up without using ant?

If you can, then tell me how? If you cannot, then ant cannot do it.

As far as I know, you cannot set classpath to point to a nested jar inside another jar. I could be wrong on this, let me know...

I think I have a simple solution for you. When you jar the outer jar, you can put all the inner jar contents inside the outer jar. Then your problem is solved.

Thanks!
 
pradeep selvaraj
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do you mean domething like this?

=============
myapp.jar
-dependent.jar
-mypackageDir
===============

====OR========
HomeDIR
-dependent.jar
-myapp.jar
--mypackageDIR
==============

Since i am writing an AntTask, I prefer the first method. If i use the second mthod (which is working) then the jar should always dependent on external things. Can someone let me know how to set the classpath if using the first method?

Thank You
[ June 15, 2006: Message edited by: pradeep selvaraj ]
 
Roseanne Zhang
Ranch Hand
Posts: 1953
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think I misunderstood your question, ignore my previous answer. I thought you wanted to include another jar inside the jar. Sorry!

Now, I am not sure what you really want. However, my suggestion is writing a batch or shell script to do what you want, then you will know how to it with ant.

GOOD LUCK!
 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Zhang you are right . As according to jar specs from SUN at http://java.sun.com/j2se/1.3/docs/guide/jar/jar.html#JAR%20Manifest you can't have classpath as an attribute in a jar manifest.
Summary is ant will also not allow you to do this .

What you can do is include smaller jars in the bigger jar and then put bigger jar in the classpath .
 
pradeep selvaraj
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Zhang,
You got it right in the first reply, but i did not understnad what you ment by this

Originally posted by Roseanne Zhang:


I think I have a simple solution for you. When you jar the outer jar, you can put all the inner jar contents inside the outer jar. Then your problem is solved.



Could you please explain.

Thanks
 
Roseanne Zhang
Ranch Hand
Posts: 1953
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If that is the case, you can use ant <unjar> task to unjar the inner jar into a temp directory, then <jar> everything together. Set your Class-Path and Main-Class to the proper ones.

Good luck!
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic