cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
mr_paff
Level 2

Custom Code depending on jars, which are part of the installation

Hello,

I have the following use case:
I am creating multiplatform installer for a java desktop application with IA 2011 SP3
In the Pre-Install phase I want to execute some custom code actions. This custom code depends on some classes, which are bundled in jars, which will be installed on the user's machine. The jars, which I depend on are signed.

I tried different ways to make this work, but without success.

I tried adding the jars as dependencies to the execute custom code action, but in this case the jars are added twice and the size of my installer increases, which is something I want to avoid.

I tried adding the jars in the classpath through Project -> JVM Settings -> Installer Settings -> Additional Classpath Settings
When I add them with absolute path (pointing to the jar in my workspace) it works. Of course this will work only on my machine.

When I add them with relative path (for example $IA_PROJECT_DIR$\..\..\..\target\libs\dependency.jar) I get the following error in the logs

Execute Custom Code
java.lang.ClassNotFoundException: MyCustomAction 1 class MyCustomAction unavailable

MyCustomAction is the class, which calls a function from another class, which is part of the dependency.jar I add to the classpath

In the help pages of IA 2011 SP3 it is said

"If you want to add additional resources/classpaths without embedding them, you can use the fields in the Additional Classpath Settings area.
• Resolved relative to installer’s location—The paths are resolved relative to the installer’s location during runtime."

What does it mean that the paths are resolved relative to the installer's location during runtime? The jar I want to reference is packed inside the Resource1.zip in AppData\Local\Temp\IXXXXXXX\InstallerData\Disk1\InstData

I couldn't find any example of this neither in the help pages, nor in the internet.

Does anyone have any idea how can I make this work?

Thanks in advance,
Pavel
Labels (1)
0 Kudos
(2) Replies
madhavbantwal
Level 6

Hi,

I Will assume that your jars are pre-copied to Target machine which runs your installater ,say /root/depjars or C:/depjars

One thing we need to remember here is relative path should be given w.r.t $EXTRACTOR_DIR$

$EXTRACTOR_DIR$ always points to the installer which will be built
i.e for ex if i name my project as "sample"

$EXTRACTOR_DIR$ will be point to C:/sample/sample_Build_output/Default_configuration/Instdata/Windows/VM/install.exe

So now My classpath reference becomes ../../../../../../depjars/ant.jar

1. Add your custom code action(And Include your custom cod.jar) at pre-install
2. Now,Navigate to Project-->JVM Settings-->Installer Settings and in the additional classpath add the "../../../../../../depjars/ant.jar" if your depedency.jar is located say in either C:\depsjar or /root/depsjar.

Hope this Helps?

Thanks,
Madhav Pai
0 Kudos
kyoung
Level 3

All these years later I am looking for a solution to this type of installation issue that I am having. I am using a very old version of IA - IA 8.

Did you/anyone ever help with this. If so please let me know the answer. I've also done a fresh post to the forum for earlier/retired versions of IA.
Thanks.
0 Kudos