I am getting Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException while running applet launched via JNLP.
My applet code is
package com.oprs.common;
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.*;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import org.jfree.util.Log;
/**
 *
 * @date Aug 29, 2012 11:33:16 AM
 * @version 1.0
 */
public class OprsJNLP {
    /**
     * @param args
     */
    static BasicService basicService = null;
    public static void main(String[] args) {
    JFrame frame = new JFrame("OPRS");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JLabel label = new JLabel();
    Container content = frame.getContentPane();
    content.add(label,BorderLayout.CENTER);
    String message = "Download OPRS Application";
    label.setText(message);
    try {
        basicService = (BasicService)ServiceManager.lookup("javax.jnlp.BasicService");
    } catch (UnavailableServiceException e) {
        Log.error("service not available", e);
    }
    JButton button = new JButton("http://google.com/");
    ActionListener listener = new ActionListener() {
        public void actionPerformed(ActionEvent event) {
        URL url;
        try {
            url = new URL(event.getActionCommand());
            basicService.showDocument(url);
        } catch (MalformedURLException e) {
            e.printStackTrace();
        }       
        }
    };
    button.addActionListener(listener);
    content.add(button, BorderLayout.SOUTH);
    frame.pack();
    frame.show();
    }
}
I tried to debug and found that basicService is returning null always. In place of google.com i tried with the other url's but still getting the same error. The line basicService.showDocument(url); is where it throws null pointer because my basicService is null. Can some one point out where exactly i am going wrong ?
Including my .jnlp
<?xml version='1.0' encoding='UTF-8' ?>
<jnlp spec='1.0'
      codebase='http://localhost:9999/'
      href='oprs.jnlp'>
  <information>
    <title>OPRS</title>
    <vendor>OPRS</vendor>
    <description kind='one-line'>
      OPRS WEB START
    </description>
    <shortcut online='false'>
      <desktop/>
    </shortcut>
  </information>
  <resources>
    <j2se version='1.4+' />
    <jar href='oprs.jar' main='true' />
  </resources>
  <application-desc main-class='com.oprs.OprsJNLP' />
</jnlp>
