cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

How to call a public static void main(String[] args) method in an ACL function

SOLVED
Highlighted
Garnet

How to call a public static void main(String[] args) method in an ACL function

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 ?

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Re: How to call a public static void main(String[] args) method in an ACL function

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

View solution in original post

2 REPLIES 2
Highlighted

Re: How to call a public static void main(String[] args) method in an ACL function

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

View solution in original post

Highlighted

Re: How to call a public static void main(String[] args) method in an ACL function

Hi Sirko,

Thank you for your help.

Kind regards

David

Announcements