Hi!
I'm trying to pack a library I wrote into a jar file. This library uses another external library (the trustice tar library to be exact), and I would like to put that in my jar file too, so that whoever uses my library doesn't have to add 3 different jar files (mine, tar.jar and a weird "activation.tar") to the project but just the one.
Now, I've packed all of my classes and the given libraries into a java archive and I added - Class-path: lib/tar.jar lib/activation.jar
to the Manifest file (the paths are correct), but when I try to use the library, I get a - java.lang.NoClassDefFoundError: com/ice/tar/TarArchive
error. So, I must have left something out. I've searched online, but somehow can't find what I need. Can anybody give me a hint?
Greetings,
Nepomuk
6 3178
OK, after reading in the Sun Jar packing tutorial I know, why it doesn't work like that:
The Class-Path header points to classes or JAR files on the local network, not JAR files within the JAR file or classes accessible over internet protocols. To load classes in JAR files within a JAR file into the class path, you must write custom code to load those classes. For example, if MyJar.jar contains another JAR file called MyUtils.jar, you cannot use the Class-Path header in MyJar.jar's manifest to load classes in MyUtils.jar into the class path.
But what would such custom code look like?
Greetings,
Nepomuk
Note : The Class-Path header points to classes or JAR files on the local network, not JAR files within the JAR file or classes accessible over internet protocols. To load classes in JAR files within a JAR file into the class path, you must write custom code to load those classes. For example, if MyJar.jar contains another JAR file called MyUtils.jar, you cannot use the Class-Path header in MyJar.jar's manifest to load classes in MyUtils.jar into the class path.
. .
Soon after that note, they give an example of how to do it.
Soon after that note, they give an example of how to do it.
Well, not on the same page at least. (Neither could I find one on a following page.) The example they do give is about how to use the classpath option, if the other jars ARE in the same directory as mine, not if they're packed inside my jar file. But that's not what I want, because I just want to deliver one jar file instead of three. They say, that it's possible with custom code, but what can I imagine that to look like? How can I write it myself if necessary? Which classes would I need and where should my custom code go?
Greetings,
Nepomuk
Hi! I am also looking for a solution for the same. Did you get what custom code can be written to load the classes in a jar within a jar file?
Thanks.
Neha
You need an extra classloader to load classes from a JarEntry in another JarEntry.
But then again, that additional classloader separates the classes from each other:
not loaded by this loader and loaded by this loader. You don't know in advance
which loader to use which renders the entire scenario useless. Better install a
couple of jar files and let the standard class loader do all the work.
kind regards,
Jos
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Carl Waldbieser |
last post by:
I tried to adapt the instructions for building the M2Crypto module
(http://sandbox.rulemaker.net/ngps/m2/INSTALL.html) to build a version
compatible with Python2.3, but I've had some mixed results....
|
by: PatchFactory Support |
last post by:
Description:
Professional and easy-to-use patch building environment that can help
you to create instant patch packages for software and file updating.
Generated patch packages are small size...
|
by: Programatix |
last post by:
Hi,
I'm trying to apply Strong Name to my project and I get the following error
while building the project,
Building satellite assemblies...
Satellite build for culture 'ms-MY' failed. Please...
|
by: Programatix |
last post by:
I'm working on a VB .Net project. I tried to make the project strong named
and I get the following error during building.
Performing main compilation...
vbc : error BC30140: Error creating...
|
by: teoryn |
last post by:
I've been spending today learning python and as an exercise I've ported
a program I wrote in java that unscrambles a word. Before describing
the problem, here's the code:
*--beginning of file--*...
|
by: Zeng |
last post by:
Hello,
I don't know why I'm the only one in my development team get this build
error when I build the entire solution. CommonLib.dll is a binary file
resulted of building another project...
|
by: theburnetts |
last post by:
I am building an ASP.NET application that has a requirement that the
user should be able to download all of the data that they have input
into the system and save it to a file on their local PC. ...
|
by: wpw |
last post by:
Hi
I have problem in building my application wich contains 54 dlls and one of
which is always fails in building in both modes, this particular dll is
around 69K and only workaround sofar is to...
|
by: vedrandekovic |
last post by:
Hi,
I have already install Microsoft visual studio .NET 2003 and MinGw,
when I try to build a extension:
python my_extension_setup.py build ( or install ) , I get an error:
LINK : fatal...
|
by: bkamrani |
last post by:
Hi Python gurus,
I have installed numpy and interested in testing f2py module using the
first example in the documentation.
First I tried:
C:\test>python "C:\Program...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
| |