cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
robsahm
Level 4

Calling custom java code

I am having serious issues calling custom java code external to ISMP. Here is what I am doing :

package com.xxx.installshield;

public class driver {
public static void main(String args[]){
System.out.println("driver");
}

}


From within a custom event handler we are calling :

public void onExecutingcheckProcs(com.installshield.event.wizard.WizardActionContext arg0)
{
System.out.println("before checkProcs");
driver test = new driver();
System.out.println("before checkProcs");
}

Only the first system.out prints and nothing else. They system.out from the external does not get called nor does the one after the call to the external. I have tryed a try/catch block but nothing is displayed, the install just continues fine. Please help!!!
Labels (1)
0 Kudos
(4) Replies
robsahm
Level 4

I found how to do this if you use the method

support.putClass(xxx)

However this is crazy if you want to use a large 3rd party package. The only way I have found to be able to use 3rdparty code is to load each and every class file from a .jar file using the support.putClass(xxx) method. This can not be the right way to do this, please help!!!
0 Kudos
RobertDickau
Flexera Alumni

If the external classes are in a JAR file, perhaps you can use putArchive instead of putClass. Searching these forums and the API docs should return a few examples.
0 Kudos
robsahm
Level 4

It only worked 1/2. If I put the following line in :

support.putArchive("GetProcessList.jar",new AllArchiveFilter());

Then it fails at build time not being able to find a specific .class file from within this .jar file. I have to extract the .class file from the JAR file or the build will not work. The runtime seems to work, however It may be using the single class its asking for at build time. Build time says it cant find the .class file but I have not mentioned the .class file anymore... Strange.

Here is the build error :

java.io.FileNotFoundException: could not find resource com/sap/installshield/GetProcessList.class Resource Builder (bean2)


However inside of bean2 I am referencing teh .jar NOT the .class
0 Kudos
RobertDickau
Flexera Alumni

As a test, does it make any difference if you pass a full path to the JAR file on your build system?
0 Kudos