ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

How to call java main(String[] args) from RPG

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to call java main(String[] args) from RPG

    I'm getting a "class not found calling method "main" with signature ..." error when trying to call a java app that has a "main" method. I'm pretty sure it's because of the string array parameter. I don't think I'm prototyping it correctly.

    This is the java main method signature:
    Code:
    public static void main(java.lang.String[] args)
    Has anyone accomplished this?

    Thanks,
    Mike

  • #2
    You need to set the CLASSPATH environment variable

    Comment


    • #3
      I have. I pointed it to the .jar. It is an IFS folder and has no restrictions. I can run it with the "JAVA" command but not with the RPGLE pgm. Here's my prototype definition:
      Code:
      dcl-pr text2Png extproc(*java: 'com.qkd.TextToImage': 'main') static;
           args object(*java: 'java.lang.String') options(*varsize) dim(2);
      end-pr;​

      Comment


      • #4
        The successful "JAVA" command looks like this:

        Code:
        JAVA CLASS(com.qkd.TextToImage) PARM(MIKE '/landrive/mlopez/java/xxx.png') CLASSPATH('/landrive/mlopez/java/*')​

        Comment


        • #5
          I found the problem. My class path had a semicolon, not colon. ".:/landrive/mlopez/Java/"

          Comment

          Working...
          X