className.main(new String[]{"filename.txt"})?
<p>I created a class that does some file parsing for me. I made it possible to be started as a standalone application, taking file name from command line.
Now I created another class, that needs to take advantage of what the first class is doing, and I tried to call its main method like this:</p>

<pre><code>className.main(new String[]{"filename.txt"});
</code></pre>

<p>However, it seems that things aren't doing so fine, because I was getting some null pointer exceptions. When I inserted <code>system.out.println(args[0])</code> to see what was going on, I got the reference to the resource, and not the string I was expecting.</p>

<p>Here is more code:</p>

<pre>
<code>
// this is from the class that is reffered as 'new one'
// Cal the maze solver now for out.txt
        String[] outFile = new String[]{"out.txt"};
        MazeSolver.main(outFile);

// this is part of the MazeSolver main method
public static void main(String[] args) {
        if(args.length != 1) {
            System.out.println("Usage: java MazeSolver ");
            System.exit(0);
        }
// this is the part where i tried to debug
        System.out.println(args.toString()); 


// and this is the error message that i got in terminal
// <b>[Ljava.lang.String;@63b9240e</b>   &lt;---------------------------------------
//ROWCOUNT: 199
//Exception in thread "main" java.lang.NullPointerException

</code>
</pre>

<p>Do I need to create one more method, doing the exact same thing, but with different name?</p>

<p>Thanks</p>
