How to set java.net.preferIPv4Stack=true at runtime?

前端 未结 6 1668
半阙折子戏
半阙折子戏 2020-12-13 12:56

I need to disable IPv6. For that the java documentation indicates setting jvm property java.net.preferIPv4Stack=true.

But I don\'t understand how to do

6条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-13 13:32

    Another approach, if you're desperate and don't have access to (a) the code or (b) the command line, then you can use environment variables:

    http://docs.oracle.com/javase/7/docs/webnotes/tsg/TSG-Desktop/html/plugin.html.

    Specifically for java web start set the environment variable:

    JAVAWS_VM_ARGS

    and for applets:

    _JPI_VM_OPTIONS

    e.g.

    _JPI_VM_OPTIONS=-Djava.net.preferIPv4Stack=true

    Additionally, under Windows global options (for general Java applications) can be set in the Java control plan page under the "Java" tab.

提交回复
热议问题