Is it possible to get the parameter sent to the java launcher, set it as a environment property (for the lifetime of the java process) before launching the application ?

For E.g: If the input parameter to the Java launcher (.exe) is a file path. I want to set the environment variable as INPUT_FILE_PATH=%1. Then in the java code I would use it as System.getEnv("INPUT_FILE_PATH").

With a batch file this is possible but how to configure it with a Java launcher ?

asked 17 May '12, 16:08

Dracu's gravatar image

accept rate: 0%

Unfortunately it is not possible to run any actions (such as setting environment variables) prior to launching the Java process.

What you can do is pass the parameters by setting <allowCommandLineArguments> to 1 and then have Java process set appropriate values to environment.


answered 18 May '12, 11:03

wojciechka's gravatar image

wojciechka ♦♦
accept rate: 26%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: 17 May '12, 16:08

Seen: 1,782 times

Last updated: 18 May '12, 11:03