Question

My application sets CLASSPATH in a shell script named shrc that sets up the environment to run java commands. Is there an easy way to pass the CLASSPATH used in an installed application to install4j so I can use it in an action? The working solution I have uses "Run executable or batch file" to run a script that does this:

  . ./shrc
  ${APPHOME}/jre/bin/java -cp ${CLASSPATH} ...etc...

I do this within an add-on installer, so the shrc already exists, but I need to run some of the existing java code to configure the patches.

It seems to me there must be a better way to do this that would work on Windows also. Any help is appreciated.

Was it helpful?

Solution

To read environment variables, use

System.getenv("CLASSPATH")

If you would like to use it as an install4j installer variable, add a "Set a variable" action with the above line as the script.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top