通过JNLP的Java Applet:System.Properties不是"设置" [英] Java Applet via JNLP: System.Properties not being "set"

查看:541
本文介绍了通过JNLP的Java Applet:System.Properties不是"设置"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是多年以来我在Java中工作过(这是我的借口)。

我试图推出的Java Swing UI作为一个小程序(通过Web Start的pviously做$ P $)。

我已经修改JNLP文件,以反映我知道是必要的一个小程序的改变(例如,使用applet的递减,而不是应用程序DESC)。

<资源> 标记中的JNLP文件中,我们设置了系统属性是这样的:

 <属性名=java.security.auth.login.configVALUE =$$背景/应用/ auth.conf/>

在主类的init方法,我们试着去阅读一些系统属性,始终得到空作为值。


  1. 没有人有任何想法,为什么系统属性不是坚持?


  2. 可能与陌生感:我有Java的一套东西运行时打开控制台。当我与该applet加载页面时,控制台窗口打开两次,两个窗口显示加载JNLP的细节,但只有一个窗口,充分应用负载继续。


更新:

下面是JNLP文件:

 <?XML版本=1.0编码=UTF-8&GT?;
< JNLP规范=1.0+>
  <信息>
    <标题>应用< /标题>
    <离线允许/>
  < /信息>
  <安全>
    <所有的权限/>
  < /安全>
  <资源>
      < J2SE版本=1.6+的Java VM-ARGS = - Xms128m -Xmx1024m -Xss1m/>
      <属性名=java.naming.factory.initial的VALUE =org.jboss.naming.HttpNamingContextFactory/>
      <属性名=java.naming.factory.url.pkgsVALUE =org.jboss.naming:org.jnp.interfaces/>
      <属性名=java.naming.provider.url的VALUE =$$上下文/调用/ JNDIFactory/>
      <属性名=java.security.Policy中的价值=$$背景/应用/的server.policy/>
      <属性名=java.security.auth.login.configVALUE =$$背景/应用/ auth.conf/>
      <属性名=login.contextVALUE =客户登录/>
      <属性名=jndi.port值=1099/>
      <属性名=service.implVALUE =远程/>
      <属性名=轮询值=真/>
      <罐子HREF =CGLIB-2.1.3.jar/>
      <罐子HREF =com.jdas.apps.binmgmt.gui.jar主要=真/>
      <罐子HREF =公地beanutils.jar/>
      <罐子HREF =commons-collections提供-2.1.1.jar/>
      <罐子HREF =公地javaflow.jar/>
      <罐子HREF =公地lang.jar/>
      <罐子HREF =公地logging.jar的/>
      <罐子HREF =ECS-1.4.1.jar/>
      <罐子HREF =hibernate.jar文件/>
      <罐子HREF =iText的-1.01.jar/>
      <罐子HREF =玉5.2.3_AGRIS_PATCH.jar/>
      <罐子HREF =jbossall-client.jar中/>
      <罐子HREF =的jboss-j2ee.jar的/>
      <罐子HREF =jcalendar-1.1.4-agris.jar/>
      <罐子HREF =jhall-3.1.3.jar/>
      <罐子HREF =看起来-ALL-1.1.jar/>
      <罐子HREF =ODMG-3.0.jar/>
      <罐子HREF =pvjdbc2.jar/>
      <罐子HREF =摇摆布局1.0.jar/>
      <扩展名=额外的href =unsigned.jnlp/>
  < /资源>
  <小程序 - 递减主级=com.jdas.apps.binmgmt.gui.main.BinManagementAppNAME =binMgmtWIDTH =1024HEIGHT =768>  < / applet的递减>
< / JNLP>


解决方案

您需要签署JNLP文件以设置系统属性(比那些有特殊<一个属性其他href=\"http://download.oracle.com/javase/6/docs/technotes/guides/javaws/developersguide/syntax.html#resources\"相对=nofollow>豁免)。看一些那些你想设置的属性!

要签名JNLP文件,把一个字节的字节副本(最好坚持US-ASCII(!))签署的jar之前JNLP-INF / APPLICATION.JNLP。

It is years since I have worked in Java (that's my excuse).

I am trying to launch a Java Swing UI as an Applet (previously done via Web Start).

I have modified the jnlp file to reflect the changes that I know are necessary for an applet (e.g. using applet-desc instead of application-desc).

Inside the <resources> tag in the jnlp file we set system properties like this:

<property name="java.security.auth.login.config" value="$$context/app/auth.conf"/>

In the init method of the main class we try to read some of these system properties and always get "null" as the value.

  1. Does anyone have any ideas why the system properties aren't "sticking"?

  2. Possibly related strangeness: I have Java set to open the console when something runs. When I load the page with this applet, the console windows opens TWICE, both windows showing the details of loading the jnlp, but only one window continues with the full app load.

UPDATE:

Here is the jnlp file:

 <?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="1.0+" >
  <information>
    <title>app</title>
    <offline-allowed/>
  </information>
  <security>
    <all-permissions/>
  </security>
  <resources>
      <j2se version="1.6+" java-vm-args="-Xms128m -Xmx1024m -Xss1m"/>
      <property name="java.naming.factory.initial" value="org.jboss.naming.HttpNamingContextFactory"/>
      <property name="java.naming.factory.url.pkgs" value="org.jboss.naming:org.jnp.interfaces"/>
      <property name="java.naming.provider.url" value="$$context/invoker/JNDIFactory"/>
      <property name="java.security.policy" value="$$context/app/server.policy"/>
      <property name="java.security.auth.login.config" value="$$context/app/auth.conf"/>
      <property name="login.context" value="client-login"/>
      <property name="jndi.port" value="1099"/>
      <property name="service.impl" value="Remote"/>
      <property name="polling" value="true"/>
      <jar href="cglib-2.1.3.jar"/>
      <jar href="com.jdas.apps.binmgmt.gui.jar" main="true"/>
      <jar href="commons-beanutils.jar"/>
      <jar href="commons-collections-2.1.1.jar"/>
      <jar href="commons-javaflow.jar"/>
      <jar href="commons-lang.jar"/>
      <jar href="commons-logging.jar"/>
      <jar href="ecs-1.4.1.jar"/>
      <jar href="hibernate3.jar"/>
      <jar href="itext-1.01.jar"/>
      <jar href="jade-5.2.3_AGRIS_PATCH.jar"/>
      <jar href="jbossall-client.jar"/>
      <jar href="jboss-j2ee.jar"/>
      <jar href="jcalendar-1.1.4-agris.jar"/>
      <jar href="jhall-3.1.3.jar"/>
      <jar href="looks-all-1.1.jar"/>
      <jar href="odmg-3.0.jar"/>
      <jar href="pvjdbc2.jar"/>
      <jar href="swing-layout-1.0.jar"/>
      <extension name="additional" href="unsigned.jnlp"/>
  </resources>
  <applet-desc main-class="com.jdas.apps.binmgmt.gui.main.BinManagementApp" name="binMgmt" width="1024" height="768" >

  </applet-desc>
</jnlp>

解决方案

You will need to sign the JNLP file in order to set system properties (other than those properties that have special exemption). Look at some of those properties you are trying to set!

To sign a JNLP file, put a byte-for-byte copy (best to stick to US-ASCII(!)) in JNLP-INF/APPLICATION.JNLP before signing the jar.

这篇关于通过JNLP的Java Applet:System.Properties不是&QUOT;设置&QUOT;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆