Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X
I begin to do a java class, but I have a problem to call the "main" method in Arbortext.
My java class:
public class HelloObjIs
{
public static void main (String args[])
{
System.out.println("Hello");
}
}
How to call a public static void main(String[] args) method in an ACL function ?
Solved! Go to Solution.
Hi David,
to call a static method from ACL you have to use the java_static() ACL function. In your case the call would be:
ret = java_static("HelloObjIs","main",args);
Now for the args you need to convert an ACL array to a Java array. Basically you would do the following in ACL:
local myarr[];
# ... put in values as needed or leave empty...
myarr[1] = "something";
# now convert to Java array
local obj = java_array_from_acl(myarr,"[Ljava/lang/String;");
# now call your static method with parameters
ret = java_static("HelloObjIs","main",obj);
Hope that helps.
Kind regards
Sirko
Hi David,
to call a static method from ACL you have to use the java_static() ACL function. In your case the call would be:
ret = java_static("HelloObjIs","main",args);
Now for the args you need to convert an ACL array to a Java array. Basically you would do the following in ACL:
local myarr[];
# ... put in values as needed or leave empty...
myarr[1] = "something";
# now convert to Java array
local obj = java_array_from_acl(myarr,"[Ljava/lang/String;");
# now call your static method with parameters
ret = java_static("HelloObjIs","main",obj);
Hope that helps.
Kind regards
Sirko
Hi Sirko,
Thank you for your help.
Kind regards
David