Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Runtime.exec: strange NullPointerException

843798Mar 24 2003 — edited Mar 22 2007
Hi there!

Since I'm using Runtime 1.4.1-b21 (Windows) it seems that I can't use Runtime.exec any more. The following example code doesn't work:

public class Test
{
public static void main(String[] args) throws Exception
{
Runtime lRuntime = Runtime.getRuntime();
Process lProcess = lRuntime.exec("last.exe");
}
}

I get the following null pointer exception:

D:\test>java Test
Exception in thread "main" java.lang.NullPointerException
at java.lang.Runtime.exec(Runtime.java:551)
at java.lang.Runtime.exec(Runtime.java:491)
at java.lang.Runtime.exec(Runtime.java:457)
at Test.main(Test.java:23)

I don't know why this happens. 'last.exe' is a simple command line tool. I can use any other program - same error!

Greeting,
Markus
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 19 2007
Added on Mar 24 2003
2 comments
620 views