Deployment and testing locally Java Web Start application in Netbeans

This time You create application, which will be run throught browser as web standalone application. This mechanism is Java Web Start technology. Let’s begin.

Open Netbeans IDE and from menu choose File->New Project.

In New Project window from Categories choose Java and from Projects choose Java Application. Click the Next.

In Projects Name field of wizard write MyApp and click the Finish button.

In the Projects window You see tree of the MyApp project.

Open main class your application(MyApp.java file) and paste into it this code:

package myapp;
import java.awt.Color;
import java.awt.EventQueue;
import javax.swing.JFrame;
public class MyApp {
    public static void main(String[] args) {       
      EventQueue.invokeLater(new Runnable(){
      public void run()
      {
          JFrame frame = new JFrame("My first application Java Web Start");
          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          frame.setSize(400,300);
          frame.getContentPane().setBackground(Color.orange);
          frame.setVisible(true);
      }
      });       
    }   
}

 Run application selecting name of project from Projects window of Netbeans and clicking on this  icon:

Application running and this window appear:

But we would like to call this application on the web as Java Web Start. So right click on the project node and choose Properties.

Project Properies window appear. Select from Categories section  Web Start in it.

Select Enable Web Start and from Codebase list choose Local Execution, because we would like to test this application locally.

Signing leave as Unsigned.

In Control Panel in Windows OS open Java Control Panel. You may in General tab click on Settings button.

In next step of wizard click on Delete Files button.

In next step select only checkbox with Trace and log files and with Cached Application and Applets.

Click the OK button.

In Security tab choose Medium of Security Level.

And it is default settings in Advanced tab:

Click the OK button and close Control Panel in Windows OS.

Select project node in Projects window in Netbeans and click on this icon(Build and Clear) from toolbar: In Output window you see:

Open your main folder of your project from Documents. In MyApp folder you see dist catalogue.

In it are: MyApp.jar(archive and executable file for MyApp application), launch.jnlp file which call appliocation – this jar file and launch.html file, from it is calling jnlp file.

Open launch.html file. The browser opend. If you see Active Java Development Toolkit, click on it.

This information disappear and you may click the Launch button.

Select Open throught Java Web Start Launcher and click on OK button.

If you see Security Warning window, click the Run button.

You see your application running throught Java Web Start.