albertkao
albertkao

Reputation: 31

Use Eclipse to run an existing Java web start application

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> 

Upvotes: 1

Views: 4270

Answers (1)

Jan Zyka
Jan Zyka

Reputation: 17888

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! :)

Upvotes: 1

Related Questions