Modifying the Environment

Here’s a problem I just encountered … and, unfortunately, haven’t figured out a solution.

A customer is trying to run my Eclipse RCP application … but it’s crashing because it can’t find ‘com.mercury.javashared.agentloader.AgentBootstrap’ class (which is apparently part of the HP QuickTest Professional product).

Turns out they had the ‘JAVA_TOOL_OPTIONS’ environment variable set to ‘-agentlib:jvmhook’ at the system level (set in the Windows control panel).

This was causing the boot loader to try and load the class that couldn’t be found.

A temporary work around is to set the JAVA_TOOL_OPTIONS environment variable to blank every time they launch the application … but that’s a major pain in the long term.

I’d like to fix this by finding a way to override the JAVA_TOOL_OPTIONS environment variable in the eclipse.ini file, or possibly providing a different ‘-agentlib’ parameter option that will supersede the existing value.

I guess I could provide a batch file that clears the environment variable before invoking the application … but that’s kind of kludgy (IMO).

Of course, any product that sets a global environment variable such as this is (at least in my opinion) seriously broken.  The only global environment variable that any application should set (or even be allowed to set) is maybe the path.

Leave a Reply

Your email address will not be published. Required fields are marked *