使用 Eclipse 运行现有的 Java Web Start 应用程序 [英] Use Eclipse to run an existing Java web start application

查看:27
本文介绍了使用 Eclipse 运行现有的 Java Web Start 应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以使用 Java web start 在命令行上启动我的 Swing GUI 应用程序:javaws http://localhost:7001/webstart/myapp/launch.jnlp

I can use Java web start to start my Swing GUI application on the command line: javaws http://localhost:7001/webstart/myapp/launch.jnlp

如何使用 Java web start 在 Eclipse 3.3.2 和 jdk 6 中运行我的应用程序?我可以在没有 Java web start 的情况下在 Eclipse 中运行我的应用程序吗?如何?单击 Eclipse 中的 launch.jnlp 文件只会打开文本编辑器.

How to run my application inside Eclipse 3.3.2 and jdk 6 with Java web start? Can I run my application inside Eclipse without Java web start? How? Clicking the launch.jnlp file inside Eclipse only open the text editor.

launch.jnlp文件如下:

The launch.jnlp file is as follows:

<jnlp spec="1.0+" codebase="$$codebase" href="$$name"> 

  <information> 
    <title>${com.prod.my.myapp.common.client.title}</title> 
    <vendor>I</vendor> 
    <homepage href="http://devzone/english/dev%20template/html_templates/main.asp"/> 
    <description>${com.prod.my.myapp.common.client.description}</description> 
    <description kind="short">${com.prod.my.myapp.common.client.short_description}</description> 
    <icon href="$$context/images/chflag.jpg"/> 
  </information> 

  <security> 
      <all-permissions/> 
  </security> 

  <resources> 

  <java version="1.6.0_05" href="http://java.sun.com/products/autodl/j2se" max-heap-size="256m"/> 

    <!-- myapp Application --> 
    <jar href="myprod.myapp.client.jar"/> 
    <jar href="myprod.reports.jar"/> 

    <!-- TR Client jar --> 
    <jar href="extern.ejb-client.jar"/> 

    <property name="java.naming.factory.initial" value="weblogic.jndi.WLInitialContextFactory"/> 
    <property name="java.naming.provider.url" value="${com.prod.my.myapp.common.client.naming_provider}"/> 
    <property name="weblogic.jndi.enableServerAffinity" value="true" / 

  </resources> 

  <application-desc main-class="com.prod.my.myapp.common.framework.applicationmainwindow.gui.myappAp­plication"/ 

</jnlp> 

推荐答案

Java web start 只是下载 JNLP 文件中的 jars 并执行 main-class 确保所有引用的 jars在类路径上,属性通过 -D... 设置,max-heap-size 通过 VM 参数 -Xmx256m 设置.

Java web start does nothing more than it downloads the jars in you JNLP file and execute the main-class ensuring all the referenced jars are on the classpath, properties are set via -D... and max-heap-size is set via the VM parameter -Xmx256m.

如果您的项目将 JNLP 文件中列出的 jar 作为依赖项,请创建运行配置并将您的 main-class 指定为要运行的主类.您还应该将属性添加到您的运行配置中.通过添加 -Djava.naming.factory.initial=weblogic.jndi.WLInitialContextFactory 等作为命令行参数来做到这一点.

If you have a project with the jars listed in the JNLP files as dependencies create a run configuration and specify your main-class as Main Class to be run. You should also add the properties to you run configuration. Do this by adding -Djava.naming.factory.initial=weblogic.jndi.WLInitialContextFactory etc. as command line parameter.

最后添加 -Xmx256m 作为 JVM 选项.

Finally add -Xmx256m as JVM option.

祝你好运!:)

这篇关于使用 Eclipse 运行现有的 Java Web Start 应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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