title: Use Java web start to start application on the command line by the file name
body: <p>I can use Java web start to start my Swing GUI application on the command line by the url with jdk 6 &amp; Windows XP:
  javaws <a href="http://localhost:7001/webstart/myapp/launch.jnlp" rel="nofollow">http://localhost:7001/webstart/myapp/launch.jnlp</a></p>
  
  <p>How to use Java web start to start my Swing GUI application on the command line by the file name?</p>
  
  <p>The following ways do not work:
      javaws -codebase ''  launch.jnlp
      java.net.MalformedURLException: no protocol: ''
      at java.net.URL.(Unknown Source)
      at java.net.URL.(Unknown Source)
      at java.net.URL.(Unknown Source)
      at com.sun.javaws.Main.parseArgs(Unknown Source)
      at com.sun.javaws.Main.continueInSecureThread(Unknown Source)
      at com.sun.javaws.Main$1.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)</p>
  
  <pre><code>javaws -codebase "" launch.jnlp
  java.net.MalformedURLException: unknown protocol: c
      at java.net.URL.&lt;init&gt;(Unknown Source)
      at java.net.URL.&lt;init&gt;(Unknown Source)
      at java.net.URL.&lt;init&gt;(Unknown Source)
      at com.sun.javaws.Main.parseArgs(Unknown Source)
      at com.sun.javaws.Main.continueInSecureThread(Unknown Source)
      at com.sun.javaws.Main$1.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)
  
  javaws -codebase "file:." launch.jnlp
  com.sun.deploy.net.FailedDownloadException: Unable to load resource: file:./$$name
      at com.sun.deploy.net.DownloadEngine.actionDownload(Unknown Source)
      at com.sun.deploy.net.DownloadEngine.getCacheEntry(Unknown Source)
      at com.sun.deploy.net.DownloadEngine.getCacheEntry(Unknown Source)
      at com.sun.deploy.net.DownloadEngine.getResourceCacheEntry(Unknown Source)
      at com.sun.deploy.net.DownloadEngine.getResourceCacheEntry(Unknown Source)
      at com.sun.deploy.net.DownloadEngine.getResource(Unknown Source)
      at com.sun.deploy.net.DownloadEngine.getResource(Unknown Source)
      at com.sun.javaws.Launcher.updateFinalLaunchDesc(Unknown Source)
      at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source)
      at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source)
      at com.sun.javaws.Launcher.launch(Unknown Source)
      at com.sun.javaws.Main.launchApp(Unknown Source)
      at com.sun.javaws.Main.continueInSecureThread(Unknown Source)
      at com.sun.javaws.Main$1.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)
  
  javaws -codebase "file:." file://launch.jnlp
  CouldNotLoadArgumentException[ Could not load file/URL specified: file://launch.jnlp]
      at com.sun.javaws.Main.launchApp(Unknown Source)
      at com.sun.javaws.Main.continueInSecureThread(Unknown Source)
      at com.sun.javaws.Main$1.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)
  
  javaws file://launch.jnlp 
  CouldNotLoadArgumentException[ Could not load file/URL specified: file://launch.jnlp]
      at com.sun.javaws.Main.launchApp(Unknown Source)
      at com.sun.javaws.Main.continueInSecureThread(Unknown Source)
      at com.sun.javaws.Main$1.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)
  
  #The following has no error message, but nothing appear on the computer screen:
  javaws -codebase "" -J-Xrunjdwp:transport=dt_socket launch.jnlp
  javaws -J-Xdebug -J-Xnoagent -J-Xrunjdwp:transport=dt_socket,server=n,suspend=y launch.jnlp
  javaws -codebase "" -J-Xrunjdwp:transport=dt_socket,server=n,suspend=n launch.jnlp
  javaws -codebase "" -J-Xrunjdwp:transport=dt_socket,server=y,suspend=n launch.jnlp
  </code></pre>
  
  <p>The launch.jnlp file is as follows: </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; 
  
  &lt;jnlp spec="1.0+" codebase="$$codebase" href="$$name"&gt; 
  
    &lt;information&gt; 
      &lt;title&gt;${com.prod.my.myapp.common.client.title}&lt;/title&gt; 
      &lt;vendor&gt;I&lt;/vendor&gt; 
      &lt;homepage href="http://devzone/english/dev%20template/html_templates/main.asp"/&gt; 
      &lt;description&gt;${com.prod.my.myapp.common.client.description}&lt;/description&gt; 
      &lt;description kind="short"&gt;${com.prod.my.myapp.common.client.short_description}&lt;/description&gt; 
      &lt;icon href="$$context/images/chflag.jpg"/&gt; 
    &lt;/information&gt; 
  
    &lt;security&gt; 
        &lt;all-permissions/&gt; 
    &lt;/security&gt; 
  
    &lt;resources&gt; 
  
    &lt;java version="1.6.0_05" href="http://java.sun.com/products/autodl/j2se" max-heap-size="256m"/&gt; 
  
      &lt;!-- myapp Application --&gt; 
      &lt;jar href="myprod.myapp.client.jar"/&gt; 
      &lt;jar href="myprod.reports.jar"/&gt; 
  
      &lt;!-- TR Client jar --&gt; 
      &lt;jar href="extern.ejb-client.jar"/&gt; 
  
      &lt;property name="java.naming.factory.initial" value="weblogic.jndi.WLInitialContextFactory"/&gt; 
      &lt;property name="java.naming.provider.url" value="${com.prod.my.myapp.common.client.naming_provider}"/&gt; 
      &lt;property name="weblogic.jndi.enableServerAffinity" value="true" / 
  
    &lt;/resources&gt; 
  
    &lt;application-desc main-class="com.prod.my.myapp.common.framework.applicationmainwindow.gui.myappAp­plication"/ 
  
  &lt;/jnlp&gt; 
  </code></pre>