It's all about the answers!

Ask a question

Java Build Engine environment variables


Travis Hyatt (611115) | asked Sep 03 '09, 4:06 p.m.
Hello...

(I can't get a less than or greater than sign to show up in my code samples, so know that ~ means less than and /~ is /greaterthan)

We are attempting to set up a build for our Visual Studio project. The build engine service described below is running on a Windows XP machine.

We have a build engine service running with the following command:

C:\Builds\v12\JavaServiceLauncher\bin\jsl.exe

The service is running under a domain user account. If we log into the XP machine, and start a command prompt, the PATH environment variable contains about a dozen paths, including c:\windows\system32 as expected.

We call msbuild.exe project.msproj. One of the targets calls an exec task:

~exec command="xcopy "pathtofile" "pathtodest" /E /Y" /~

The resulting log says that "'xcopy' is not recognized as an internal or external command, operable program or batch file."

If we use

~exec command="c:\windows\system32\xcopy "pathtofile" "pathtodest" /E /Y" /~

the build successfully completes.

We changed the command of our build definition to simply execute cmd /c PATH. The results of that build showed that, at the time of execution of the command, the path environment variable is:
PATH=C:\JAVA\TEST

How do we get the PATH environment variable to retain its value under the context of jsl.exe?

3 answers



permanent link
Nick Edgar (6.5k711) | answered Sep 14 '09, 12:42 p.m.
JAZZ DEVELOPER
The problem is that a program launched as a Windows service does not run under the normal shell, and so it does not have the usual path set.

The release notes for the latest version of Java Service Launcher state:

Release 0.99j (January 2009) Variables defined in the .ini files section can now be exported to the environment. The new "export" parameters in the section contains a comma separated list if variables to be exported (e.g. export = PATH,CLASSPATH ). The "wrkdir" parameters treats paths starting with a "." special. As a service has no shell from which to inherit a default working directory a "." was not a valid path so far. From this version the "." in the wrkdir (and only there as all other paths will be relative to the wrkdir) will be substituted by the directory in which the .ini file resides.

(via http://jslwin.sourceforge.net/changelog.html)

So you could try setting the PATH in the .ini file. If that doesn't work, you could configure the build to run a batch script that sets up the path, then invokes the Ant script.

Regards,
Nick Edgar
RTC Build component lead

permanent link
Nick Edgar (6.5k711) | answered Sep 14 '09, 12:56 p.m.
JAZZ DEVELOPER
> I can't get a less than or greater than sign to show up in my code samples

Try checking 'Disable HTML in this post'. If HTML is enabled, it thinks <> chars are HTML tag delimiters. Another option is to use < and >.

permanent link
Travis Hyatt (611115) | answered Sep 25 '09, 4:30 p.m.
That works.

Setting the PATH variable in the section of jsl.ini does the job. We also have export=CLASSPATH,PATH but I'm not sure whether that is necessary or not.

We do not have the PATH variable set under the section of the jsl.ini.

Thanks for your help!

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.