I modified this code as follows, by including package:
package pkg1;
public class HelloWorld
{
public HelloWorld()
{
HelloWorld h = HelloWorld();
}
public String hello()
{
String helloWorld = "HelloWorld!";
return helloWorld;
}
}
Now following instructions executed:: |--> keep this file in a package called pkg1. --> Run and compile as an ordinary Java Package File, so as to create .class files. --> now your package will be stored in matlab work folder. --> so your package path is C:\Matlab\Work\pkg1 --> ------------------------------ | Now i executed following function on matlab command window:
import pkg1.*;
obj = h;
str1 = obj.hello();
Yet i have same error as mentioned above.