This is not my code. I'm just taking this for example because my real codes are long. I'm using Netbeans and i already enabled the Java Web Start on the project where this code located.
import java.awt.Font;
import javax.swing.JFrame;
import javax.swing.JLabel;
public class Tester2 {
private static void createAndShowGUI() {
JFrame.setDefaultLookAndFeelDecorated(true);
JFrame frame = new JFrame("HelloJWS");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JLabel label = new JLabel();
label.setHorizontalAlignment(JLabel.CENTER);
label.setFont(label.getFont().deriveFont(Font.PLAIN));
frame.getContentPane().add(label);
String text = null;
try {
Class sm = javax.jnlp.ServiceManager.class;
text = "<html>You're running an application "
+ "using Java<font size=-2><sup>TM</sup></font> "
+ "Web Start!</html>";
} catch (java.lang.NoClassDefFoundError e) {
text = "<html>You're running an application, "
+ "but <b>not</b> using "
+ "Java<font size=-2><sup>TM</sup></font> "
+ "Web Start!</html>";
}
label.setText(text);
frame.pack();
frame.setVisible(true);
}
public static void main(String[] args) {
javax.swing.SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
createAndShowGUI();
}
});
}
}
So when i run this code by pressing F6, it was always thrown to the catch. I don't know why. And when i try to build this code and open the Netbeans generated JNLP for this project, it shows Unable to launch the application. And when i click into Details it shows this two tab named Launch File, and Exception.
The Launch File has this log.
<jnlp codebase="file:///C:/Users/you/Documents/NetBeansProjects/Tester2/dist/" href="launch.jnlp" spec="1.0+">
<information>
<title>Tester2</title>
<vendor>you</vendor>
<homepage href=""/>
<description>Tester2</description>
<description kind="short">Tester2</description>
</information>
<update check="always"/>
<security>
<all-permissions/>
</security>
<resources>
<j2se version="1.7+"/>
<jar href="Tester2.jar" main="true"/>
</resources>
<application-desc main-class="Tester2,class"/>
</jnlp>
And the Exception tab has this log.
java.lang.NumberFormatException: For input string: "\Users\you\Documents\NetBeansProjects\Tester2\dist"
at java.lang.NumberFormatException.forInputString(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at com.sun.deploy.security.DeployManifestChecker.verifyCodebaseEx(Unknown Source)
at com.sun.deploy.security.DeployManifestChecker.verifyCodebase(Unknown Source)
at com.sun.deploy.security.DeployManifestChecker.verify(Unknown Source)
at com.sun.deploy.security.DeployManifestChecker.verify(Unknown Source)
at com.sun.javaws.security.AppPolicy.grantUnrestrictedAccess(Unknown Source)
at com.sun.javaws.security.JNLPSignedResourcesHelper.checkSignedResourcesHelper(Unknown Source)
at com.sun.javaws.security.JNLPSignedResourcesHelper.checkSignedResources(Unknown Source)
at com.sun.javaws.Launcher.prepareResources(Unknown Source)
at com.sun.javaws.Launcher.prepareAllResources(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.access$000(Unknown Source)
at com.sun.javaws.Main$1.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
How to get rid this problem?