Reputation: 138
I'm trying to convert an applet to a regular java application, using JNLP to run with. When running directly it works. But if I run via JNLP I get the stack trace below.
at com.sun.javaws.LaunchDownload.getMainClassName(Unknown Source)
at com.sun.javaws.Launcher.doLaunchApp(Unknown Source)
at com.sun.javaws.Launcher.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Main Java Class (App.java)
public static void main(String[] args) throws Exception {
String porta = args[0];
String dados = args[1];
String etiquetaBytes = args[2];
DadosEtiqueta[] dadosEtiqueta = getJsonFormString(dados, DadosEtiqueta[].class);
...
}
JNLP file (config.jnlp)
This is where the jar execution is configured
<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="1.0+" codebase="http://172.16.3.5:8080/vendor" href="jnlp/config.jnlp">
<information>
<title>App Title</title>
<vendor>Vendor Name</vendor>
<offline-allowed/>
</information>
<resources>
<j2se version="1.7+"/>
<jar href="dir1/dir2/dir3/app-title.jar" main="true" />
</resources>
<application-desc/>
</jnlp>
Maven Jar Plugin (pom.xml)
This plugin is setting the main class.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>myPackage.App</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
Upvotes: 0
Views: 721
Reputation: 573
I think your JNLP is not valid.
(see https://docs.oracle.com/javase/tutorial/deployment/deploymentInDepth/jnlpFileSyntax.html):
Note: A JNLP file must contain one of the following: application-desc, applet-desc, component-desc, or installer-desc.
And main-class
should be required for application-desc
.
Try to add
<application-desc main-class="myPackage.App" />
There might be a need to add name
, width
, height
too but the description is not very accurate on that.
Upvotes: 2