Java Web Start (Jnlp) Tutorial | Code Factory

Reference Link : Link

Donate : PayPal

Here is a brief explanation about Java Web Start from SUN

package com.codeFactory;import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.net.MalformedURLException;
import java.net.URL;
import javax.jnlp.BasicService;
import javax.jnlp.ServiceManager;
import javax.jnlp.UnavailableServiceException;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
public class Test {
static BasicService basicService = null;
public static void main(String args[]) {
JFrame frame = new JFrame("Code Factory");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JLabel label = new JLabel();
Container content = frame.getContentPane();
content.add(label, BorderLayout.CENTER);
String message = "Jnlp Hello Word";
label.setText(message);try {
basicService = (BasicService) ServiceManager.lookup("javax.jnlp.BasicService");
} catch (UnavailableServiceException e) {
System.err.println("Lookup failed: " + e);
}
JButton button = new JButton("http://34codefactory.wordpress.com");ActionListener listener = new ActionListener() {
public void actionPerformed(ActionEvent actionEvent) {
try {
URL url = new URL(actionEvent.getActionCommand());
basicService.showDocument(url);
} catch (MalformedURLException ignored) {
}
}
};
button.addActionListener(listener);content.add(button, BorderLayout.SOUTH);
frame.pack();
frame.show();
}
}
keytool -genkey -keystore testKeys -alias jdc
jarsigner -keystore testKeys TestJnlp.jar jdc
<?xml version="1.0" encoding="utf-8"?> 
<jnlp spec="1.0+" codebase="http://localhost:8080/" href="Test.jnlp">
<information>
<title>Jnlp Testing</title>
<vendor>YONG MOOK KIM</vendor>
<homepage href="http://localhost:8080/" />
<description>Testing Testing</description>
</information>
<security>
<all-permissions/>
</security>
<resources>
<j2se version="1.6+" />
<jar href="TestJnlp.jar" />
</resources>
<application-desc main-class="com.codeFactory.Test" />
</jnlp>

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store