Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » add nested jar to build path
add nested jar to build path [message #729415] Mon, 26 September 2011 06:54 Go to next message
labernit is currently offline labernitFriend
Messages: 1
Registered: September 2011
Junior Member
Hello all,

i really searched a lot but i couldn't find an answer, so i hope you can help me Smile

I have a standard java eclipse project (no maven / ant ,...) and i want to use an external software. This is provided as a jar file, and the respective dependencies are also bundled in that jar file. So the jar file looks like this:
/src
dep1.jar
dep2.jar
...

But if i simply add the overall jar to my buildpath, it seems like all the nested or inner jars (dep1.jar,...) are not correctly loaded.

So my question is, does eclipse load these inner / nested jars at all?
If not, what can i do Smile

Thanks in advance

Greetings,
Martin
Re: add nested jar to build path [message #730345 is a reply to message #729415] Wed, 28 September 2011 08:11 Go to previous messageGo to next message
Daniel Missing name is currently offline Daniel Missing nameFriend
Messages: 101
Registered: July 2011
Senior Member
Hi.

I just encountered the same problem. I created a Jar of my Project using the "Runnable JAR file" export wizard. I used the "Package required libraries into generated JAR" as library handling. Therefore all dependency jars are placed into the root of the exported JAR. If I add this "all in one"-JAR to the build path of another project the nested jars are not recognized and added to the build-path.

I also couldn't find any option like "include nested jars" or to change the class-loader.

Greetings Daniel
Re: add nested jar to build path [message #730372 is a reply to message #730345] Wed, 28 September 2011 08:50 Go to previous messageGo to next message
Dani Megert is currently offline Dani MegertFriend
Messages: 3802
Registered: July 2009
Senior Member
On 28.09.2011 10:11, Daniel wrote:
> Hi.
> I just encountered the same problem. I created a Jar of my Project
> using the "Runnable JAR file" export wizard. I used the "Package
> required libraries into generated JAR" as library handling. Therefore
> all dependency jars are placed into the root of the exported JAR. If I
> add this "all in one"-JAR to the build path of another project the
> nested jars are not recognized and added to the build-path.
> I also couldn't find any option like "include nested jars" or to
> change the class-loader.
This is expected. Java does not handle nested JARs. The 'Runnable JAR
file' export wizard not only adds the stuff to the exported JAR but also
adds a custom class loader so that the runnable JAR can be launched
outside Eclipse. Using such a JAR in another context, e.g. by adding it
to another build path, won't work.

Dani
>
> Greetings Daniel
Re: add nested jar to build path [message #730373 is a reply to message #729415] Wed, 28 September 2011 08:52 Go to previous message
Dani Megert is currently offline Dani MegertFriend
Messages: 3802
Registered: July 2009
Senior Member
On 26.09.2011 08:54, labernit wrote:
> Hello all,
>
> i really searched a lot but i couldn't find an answer, so i hope you
> can help me :)
>
> I have a standard java eclipse project (no maven / ant ,...) and i
> want to use an external software. This is provided as a jar file, and
> the respective dependencies are also bundled in that jar file. So the
> jar file looks like this:
> /src
> dep1.jar
> dep2.jar
> ..
>
> But if i simply add the overall jar to my buildpath, it seems like all
> the nested or inner jars (dep1.jar,...) are not correctly loaded.
>
> So my question is, does eclipse load these inner / nested jars at all?
> If not, what can i do :)
This is expected. Java does not handle nested JARs. You would have to
write your own class loader to do this or export your code using the
'Runnable JAR file' wizard, which adds such a class loader.

Dani
>
> Thanks in advance
>
> Greetings,
> Martin
Previous Topic:Launch Help window terminates Eclipse
Next Topic:VisualStudio-Like IDE for Server-based App?
Goto Forum:
  


Current Time: Fri Apr 19 14:16:28 GMT 2024

Powered by FUDForum. Page generated in 0.02676 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top