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

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

问题描述

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



如何在Eclipse 3.3.2和jdk 6中运行我的应用程序Java网络启动?
我可以在Eclipse中运行我的应用程序,而不需要启动Java Web?怎么样?
单击Eclipse中的launch.jnlp文件只打开文本编辑器。



launch.jnlp文件如下:

 < jnlp spec =1.0+codebase =$$ codebasehref =$$ 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_05href =http://java.sun.com/products/autodl/j2semax-heap-size =256m/>

<! - myapp应用程序 - >
< jar href =myprod.myapp.client.jar/>
< jar href =myprod.reports.jar/>

<! - TR客户端jar - >
< jar href =extern.ejb-client.jar/>

< property name =java.naming.factory.initialvalue =weblogic.jndi.WLInitialContextFactory/>
< property name =java.naming.provider.urlvalue =$ {com.prod.my.myapp.common.client.naming_provider}/>
< property name =weblogic.jndi.enableServerAffinityvalue =true/

< / resources>

< application-desc main-class =com.prod.my.myapp.common.framework.applicationmainwindow.gui.myappApplication/

< / jnlp>


解决方案

Java网络启动没有什么比下载jar在你的JNLP文件中并执行 main-class 确保所有引用的jar都在类路径上,属性通过 -D ... max-heap-size 通过VM参数 -Xmx256m 设置。



如果您有JNLP文件中列出的jars项目作为依赖关系创建运行配置,并将您的主类指定为主班要跑您还应该添加属性来运行配置。通过添加 -Djava.naming.factory.initial = weblogic.jndi.WLInitialContextFactory 等作为命令行参数来执行此操作。



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



祝你好运! :)


I can use Java web start to start my Swing GUI application on the command line: javaws http://localhost:7001/webstart/myapp/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.

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 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.

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.

Finally add -Xmx256m as JVM option.

Good luck! :)

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

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