NullPointer Exception in java code (getting Name of File:null output )
<pre><code> public class HelloWorld

 {

public static int executeLock;
public static int val;
public HelloWorld()
{
    executeLock = 0;
    val = 0;
}
public static void main(String[] args) throws Exception
{

    new HelloWorld();
    new Thread(new Runnable() {
    public void run() {
        try{


            WebFSManager wfm = new WebFSManager();

        }catch(Exception e)
        {
            e.printStackTrace();
        }
    }                      
}).start();
new Thread(new Runnable() {
    public void run() {
        try{
            while(true){
                Thread.sleep(10);

                if(executeLock&gt;=2){


                    File f = new WebFSFile("read.js");
                    System.out.println("Name of File :"+f.toString());
                    //FileInputStream f1 = new WebFSFileInputStream(f);
                    //f1.read();
                    //f.deleteOnExit();
                    break;
                }
            }       
        }catch(Exception e)
        {
            e.printStackTrace();
        }
    }                      
}).start();

}
}
 .........separate file...........................
 public class WebFSFile extends File
 {
String filename;
boolean fileExists;


public WebFSFile(File parent, String child){super(parent,child);}
public WebFSFile(String parent, String child){super(parent,child);} 
public WebFSFile(URI uri) {super(uri);} 
public WebFSFile(String filename) {

    super(filename);

            String script = "&lt;html&gt;&lt;body&gt;Hello&lt;/body&gt;&lt;/html&gt;"

           WebFSManager.writeInScriptQueue(script, false);

    String returnVal = WebFSManager.readRawReplyQueue();
    if(returnVal.equals("Error: File or directory not found"))
    {
        fileExists = false;
    }
    else if (Integer.parseInt(returnVal)==1){
        fileExists = true;
    }
    else{
        throw new WebFSClientSideException(returnVal);
    }
    this.filename = filename;
    if(this.filename == null){
        throw new NullPointerException("Null object supplied in WebFSFile constructor");
    }

}
 }
</code></pre>

<p>WebFSManager is serparate independent class that run's jetty server.when i
 instantiate WebFSFile class object and catch into File object then it jumps to WebFSFile
 constructor and then it delivers the script to WebFSManager and it replys it.but I am
 getting Name of File:null output. so help me</p>
