How to set preferIPv4Stack property for JNLP app?

I need to set java.net.preferIPv4Stack=true to an app started via JNLP (javaws and applet)

Tried those, without luck...

<j2se ...java-vm-args="-Djava.net.preferIPv4Stack=true" />
<property name="java.net.preferIPv4Stack" value="true"/>
System.setProperty("java.net.preferIPv4Stack", "true");

The only way i could make it work was seeting when launching javaws from local filesystem:

javaws -J-Djava.net.preferIPv4Stack=true myapp.jnlp

What is not possible on a applet or URL.

How should i set this property?

share | improve this question

76% accept rate
 
Best almost-answer so far: blog.brixandersen.dk/2007/04/29/…  –  Julio Faerman   Jun 27 at 21:59
 
Disabling IPV6 on my machine also got JGroups working :)  –  Julio Faerman   Jun 27 at 22:45
feedback

3 Answers

up vote 1 down vote accepted

With the Java 7 Update 6 (b17) the list of secure properties has been updated. See Bug Report 716069for further Details.

You can include this setting by specifying the following line within the resource tag:

<property name="java.net.preferIPv4Stack" value="true"/>

share | improve this answer
 
1  
That is great news, thanks!!!  –  Julio Faerman   Sep 8 at 20:30
feedback

The only properties that you can set in the JNLP are those considered secure which do not includejava.net.preferIPv4Stack.

The alternative options you have are (not tested):

  • pass the parameter directly to javaws like you did: javaws -J-Djava.net.preferIPv4Stack=true myapp.jnlp
  • Java Control Panel > Java > View > Runtime Parameters, but that is a global setting for all webstart applications and applets using the version of the JRE for which you changed the setting
  • use an environment variable: JAVAWS_VM_ARGS = -Djava.net.preferIPv4Stack=true
  • flag the setting as secure by adding a line to the deployment.properties file, located in the Deployment Home(*) : deployment.javaws.secure.properties=java.net.preferIPv4Stack- note: not sure if this is available Java > 1.5.

The first 3 options are detailed in this document.

(*) Deployment Home:
Windows XP: %HOME%\Application Data\Sun\Java\Deployment
Windows 7/Vista: %APPDATA%\..\LocalLow\Sun\Java\Deployment
Linux/Solaris: %HOME%/.java/deployment

share | improve this answer
 
The problem is you would have to teach that to your applet's users :)  –  Julio Faerman   Jul 19 at 17:44
 
@JulioFaerman Regarding option 4, I think you can install an extension and add this line to the clients' deployment.properties file... Never done that though.  –  assylias   Jul 19 at 17:53
 
did not know that, will check, many tnx!  –  Julio Faerman   Jul 20 at 2:52
feedback

Also, for future readers - environment variable for applets:

_JPI_VM_OPTIONS

e.g.

_JPI_VM_OPTIONS=-Djava.net.preferIPv4Stack=true

share | improve this answer
 
For development is ok, but for users...  –  Julio Faerman   Jul 19 at 17:45
feedback

Your Answer















 
or

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged     or ask your own question.


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值