How do I solve the problem of "java.lang​.NullPoint​erExceptio​n" in MATLAB?

조회 수: 4 (최근 30일)
Al Mamun
Al Mamun 2017년 12월 18일
I am using MATLAB 2017a. Here is my Java Code
public class HelloWorld {
public static void main( String args[] )
{
System.out.println( "Hello World:" );
if (args.length >0){
System.out.println( args[0] );
}
}
public int f1 (String args[]){
if (args.length >0){
System.out.println( args[0] );
}
return 121;
}
}
First I create an object in MATLAB
o=HelloWorld
Then I run the bellow method for seeing Output.
javaMethod('main',o,'')
This code runs but gives an error.
Hello World:
Java exception occurred:
java.lang.NullPointerException
at HelloWorld.main(HelloWorld.java:5)
How do I solve this problem?

답변 (0개)

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by