• 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.mf classpath not working in unix

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I developed program which connects to database and uses ojdbc14.jar. I have included below mentioned entries in Manifest.mf file :

Class-Path: lib/ojdbc14.jar lib/jxl.jar lib/poi-3.6.jar
Main-Class: com.xl.MainExcel

And the library files are included inside the "lib" folder in the newly created jar file.

Problem is, this program runs fine in Windows environment, but in UNIX environment, the same program gives exception "Class not found: com.oracle...."

Why so ???

Not able to figure it out. Can anybody help me how to run the same jar file in unix environment ??
Not only this other programs which requires external library files never work in unix machines whereas same works fine in Windows environment.

My requirement is, if my program requires any external jar file then i should not tell my client to include those files in respective directory, the jar file which i will be providing should run fine with the help of manifest.mf enties.

Thanks,
 
Bartender
Posts: 3323
86
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The standard classloader (certainly up to ver 1.6, not sure about ver .7) does not support loading classes from jars within jars. There are class loaders available that do support this functionality and I believe some IDE's such as Eclipse can package jars in jars by providing such a classloader.
If your jar is working on Windows and not Unix it may be picking up the classes from external jars without you realising it.
 
rajesh sherla
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tony Docherty wrote:The standard classloader (certainly up to ver 1.6, not sure about ver .7) does not support loading classes from jars within jars. There are class loaders available that do support this functionality and I believe some IDE's such as Eclipse can package jars in jars by providing such a classloader.
If your jar is working on Windows and not Unix it may be picking up the classes from external jars without you realising it.



Yes, you may be correct.
But m sure that in "Windows" there is nowhere specified to pickup the required jar files. Thus there is no way that java program(Windows OS) is picking up the jar files from external source.


Can you tell me about how to load the jar files within jar ?? i.e. which utility to use , any example etc....


Thanks,
 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Can you tell me about how to load the jar files within jar ?? i.e. which utility to use , any example etc....



As per my knowledge, we can not have jar files inside a jar file.

If your jar file has some dependencies, then place those in any directory and use manifest file with Class-Path to refer those dependencies by specifying relative path or absolute path.

 
Tony Docherty
Bartender
Posts: 3323
86
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

As per my knowledge, we can not have jar files inside a jar file.


You are correct in that the standard class loader does not support this. However, as per my earlier post, there are class loaders that can do this.

Try googling for something like "java jar in jar class loader" or read this blog http://qdolan.blogspot.co.uk/2008/10/embedded-jar-classloader-in-under-100.html.
Note: I'm not recommending this code, I've neither used it nor even studied it, I've just included the link as an example.
 
Siva Vulchi
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Try googling for something like "java jar in jar class loader" or read this blog http://qdolan.blogspot.co.uk/2008/10/embedded-jar-classloader-in-under-100.html.



Thanks for sharing!!! That blog was nice and good to know about it
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic