0

I'm working on Java.

is there any option in the "java" to set the user defined environmental variable to the executable that we will execute using "java" command. e.g. we have one option -XX:+AllowUserSignalHandlers.

BSalunke
  • 11,499
  • 8
  • 34
  • 68
  • 1
    Your question is not that clear. Do you want to set environment variable for the process that your launching? In any case see http://stackoverflow.com/questions/417152/how-do-i-set-javas-min-and-max-heap-size-through-environment-variables for some useful answers – Jayan Jan 21 '13 at 06:24

2 Answers2

0

You can set tuning parameter to JVM at the start of the program itself.

ex -

java -XMS50m -XX:+AllowUserSignalHandlers Test.class

Once jvm is started you can not set environment variables but you can view them System.genEnv it retuns an unmodifiable string map view of the current system environment.

If you are creating a new process then you can set environment variables using ProcessBuilder.environment.

Subhrajyoti Majumder
  • 40,646
  • 13
  • 77
  • 103
0

There is no environment variable that java.exe parses and used to set command line arguments.

You have to write a program/script that would process your custom environment variable and then pass to actual java program.

Jayan
  • 18,003
  • 15
  • 89
  • 143