Embedded JAR and the Classpath - Advanced Installer Community
rossj
Posts: 16
Joined: Sun Jul 03, 2011 10:07 am

Embedded JAR and the Classpath

Hello,

It states in the documentation that the embedded JAR is automatically added to the classpath. However, from what I can see, it adds it to the end of the classpath. In my application, I have a class which is intended to override a faulty class in one of the libraries which are listed in the classpaths section of AI. But it doesn't work because of the ordering.

In the Eclipse IDE, the application's own classes are always listed before other required libraries by default. I'm not sure why AI doesn't apply the same logic? (Of course now there is a backward compatibility issue to consider.)

For now, I've had to not embed the jar file so I can control its placement in the classpath. Is there a better way of doing this?

/Ross
Dan
Posts: 4530
Joined: Wed Apr 24, 2013 3:51 pm

Re: Embedded JAR and the Classpath

Hello Ross,

Indeed, this seems to be an Advanced Installer limitation. A fix will be available in a future version of Advanced Installer, thank you for bringing it to our attention.

If you have other questions, please let us know.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Embedded JAR and the Classpath

Hello,

This was fixed in version 10.9 of Advanced Installer released on January 23, 2014.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
rossj
Posts: 16
Joined: Sun Jul 03, 2011 10:07 am

Re: Embedded JAR and the Classpath

Hello again,

I'm encountering a new problem related to embedded Jar and the classpath. I'm now running AI 11.3.

I have a Jersey (part of Glassfish project) application which I instruct to scan (by reflection) for annotated classes within a specific package. The package in question is in the same jar file as my main class. Everything works fine when I don't embed the jar file. When I embed the jar file, Jersey fails to find the annotated classes when it scans for them. My application works correctly otherwise. So I'm guessing this is a classloader issue or something.

What is the difference (from a java/classpath perspective) between embedding and not embedding the main jar?

When I embed the jar, I don't list it in the classpath (which contains a single [lib_dir]*.jar entry). This case fails.

When I don't embed the jar, I explicitly add it to APPDIR and the classpath (either before or after the lib_dir entry, it doesn't matter). This works.

For what its worth, the main jar contains a Class-Path manifest entry which references all lib/*.jar files. Does this manifest entry impact on a java application deployed by AI?

Regards, Ross.
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Embedded JAR and the Classpath

Hello Ross,

First of all I apologize for my delayed reply.
What is the difference (from a java/classpath perspective) between embedding and not embedding the main jar?
The only difference is that when the JAR is embedded into an EXE Native Java Launcher, the EXE is added to the class path instead of JAR. Maybe, your Jersey application cannot scan java apps enbedded in EXE packages.
For what its worth, the main jar contains a Class-Path manifest entry which references all lib/*.jar files. Does this manifest entry impact on a java application deployed by AI?
No, the manifest entry should have the same impact as on a regular Java application.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”