How to add multiple parameters to JAVA_TOOL_OPTIONS

I want to add the following parameters to JAVA_TOOL_OPTIONS. Can someone please help me how to add them?

set JAVA_TOOL_OPTIONS=-Djava.net.preferIPv4Stack=true -Dfile.encoding=UTF8 

If I add as above, will it work?

I tried to install the above command, but I'm not sure if java selects these two options or not?

Expert help would be greatly appreciated.

+4
source share
2 answers

I tried to set this variable in my Windows environment using Java 7, and doing java -version , he set me this variable as shown below.

 C:\Users\ajduke>set JAVA_TOOL_OPTIONS=-Djava.net.preferIPv4Stack=true -Dfile.e ncoding=UTF8 C:\Users\ajduke>java -version Picked up JAVA_TOOL_OPTIONS: -Djava.net.preferIPv4Stack=true -Dfile.encoding=UTF 8 java version "1.7.0-ea" Java(TM) SE Runtime Environment (build 1.7.0-ea-b145) Java HotSpot(TM) Client VM (build 21.0-b15, mixed mode, sharing) 
+6
source

The previous answer works for Windows. For a unix-based environment, you must follow these steps:

  • Change the add line / etc / profile:

    export JAVA_TOOL_OPTIONS = '- Djava.net.preferIPv4Stack = true -Dfile.encoding = "UTF-8"

  • Run

    source / etc / profile

This will immediately set the global JAVA_TOOL_OPTIONS environment variable for all users.

+1
source

Source: https://habr.com/ru/post/1488042/


All Articles