ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Calling Java from RPGLE

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

  • Calling Java from RPGLE

    I have an interactive RPG program calling a Java method. The first time I make this call, when the JVM starts(I think), I get this screen:

    Click image for larger version

Name:	Java Screen.JPG
Views:	1
Size:	54.9 KB
ID:	127873

    Is there any way to prevent this screen from showing? I think this would be very confusing for the users.

    John

  • #2
    Re: Calling Java from RPGLE

    can you check authority on:
    Incorrect permissions on QOpenSys directory for *PUBLIC
    All my answers were extracted from the "Big Dummy's Guide to the As400"
    and I take no responsibility for any of them.

    www.code400.com

    Comment


    • #3
      Re: Calling Java from RPGLE

      *PUBLIC has all permissions for /qopensys.

      The message doesn't prevent the program from running. I guess I am mainly concerned with making it so the user doesn't see this screen at all. Not sure if there are environment variables I can set. I did find some that looked like they may control this screen, but I have been unsuccessful in getting any of them to work. It only appears the first time a Java method is called. I think it's the JVM being initialized, but not sure.

      Comment


      • #4
        Re: Calling Java from RPGLE

        Funny, I only get that screen when I do something that generates an error from a java call. A lot of times you can see what's going on from your job log. Usually there's only a pause while the JVM starts up. Do you see anything funny in your job log?
        (Just throwing stuff out here, I use a bunch of Java calls creating spreadsheets, and I don't normally see anything like this unless something goes terribly amiss)

        Comment


        • #5
          Re: Calling Java from RPGLE

          take a look at the environment variable QIBM_RPG_JAVA_PROPERTIES mine is set like so: '-Djava.version=1.4;-Dos400.stderr=file:stderr.txt;' this routes messages to a file named stderr.txt instead of to the display.
          I'm not anti-social, I just don't like people -Tommy Holden

          Comment


          • #6
            Re: Calling Java from RPGLE

            Oh nifty! I set my java version, but not the error file... Thanks Tom, that'll be handy in the future.

            Comment


            • #7
              Re: Calling Java from RPGLE

              Here is what is in my job log:

              Environment variable added.
              Environment variable added.
              Environment variable added.
              JVM properties were loaded from a properties file.
              The java.version property was detected as input. This property is used as
              output only and has no effect on JVM initialization.
              Java Virtual Machine is IBM Technology for Java. PID(6029)
              JVM properties were loaded from a properties file.

              Comment


              • #8
                Re: Calling Java from RPGLE

                Originally posted by Clarky View Post
                Here is what is in my job log:
                The java.version property was detected as input. This property is used as output only and has no effect on JVM initialization.
                JVM properties were loaded from a properties file.
                That is a warning message, when you do a WRKENVVAR what do you see?

                Comment


                • #9
                  Re: Calling Java from RPGLE

                  This is what I see when I do a WRKENVVAR:

                  Name Value
                  SKIPWASPLUGIN '1'
                  QIBM_PWRDWNSYS_CONFIRM '*NO'
                  QIBM_QSH_CMD_OUTPUT 'NONE'
                  ILE_DEBUGGER_1 'ALLOW_WIDE_SCREEN'
                  JAVA_HOME '/QOpenSys/QIBM/ProdData/JavaVM/jdk' >
                  PATH '/QOpenSys/QIBM/ProdData/JavaVM/jdk' >
                  CLASSPATH './lib/soapclient.jar:./properties:' >
                  QIBM_RPG_JAVA_PROPERTIES '-Dos400.stderr=file:STDERR.TXT;'
                  PASE_USRGRP_LIMITED 'N'
                  LIBPATH '/QOpenSys/QIBM/ProdData/JavaVM/jdk' >
                  QIBM_PASE_DESCRIPTOR_STD > 'T'
                  QIBM_JAVA_CHILD_STDIO_CO > 'N'
                  PASE_QIBM_JAVA_CHILD_STD > 'N'
                  QIBM_MULTI_THREADED 'Y'
                  PASE_THREAD_ATTACH 'Y'
                  AIXTHREAD_STK '524288'
                  PASE_PATH '/QOpenSys/usr/bin:/usr/ccs/bin:/QO' >
                  PASE_LANG 'en_US'
                  QIBM_PASE_CCSID '819'
                  PASE_LOCPATH '/usr/lib/nls/loc'
                  PASE_NLSPATH '/usr/lib/nls/msg/%L/%N:/usr/lib/nl' >
                  PASE_LC__FASTMSG 'true'
                  PASE_TZ '5,M3.2.0,M11.1.0'
                  LOGNAME 'JOHN'
                  HOME '/home/john'
                  QIBM_IFS_OPEN_MAX '66000'

                  Comment


                  • #10
                    Re: Calling Java from RPGLE

                    Here is what I initially had before I performed the Java call.

                    ADDENVVAR ENVVAR(JAVA_HOME) VALUE('/QOpenSys/QIBM/ProdData/JavaVM/jdk50/64bit')
                    ADDENVVAR ENVVAR(PATH) VALUE('/QOpenSys/QIBM/ProdData/JavaVM/jdk50/64bit/bin')
                    ADDENVVAR ENVVAR(CLASSPATH) VALUE('./lib/soapclient.jar:./properties:./lib')

                    I just added this, per Tom's suggestion:
                    ADDENVVAR ENVVAR(QIBM_RPG_JAVA_PROPERTIES) VALUE('-Dos400.stderr=file:STDERR.TXT;')

                    But it didn't make a difference.

                    Comment


                    • #11
                      Re: Calling Java from RPGLE

                      did you sign off & back on? that only takes affect when the JVM is first loaded.
                      I'm not anti-social, I just don't like people -Tommy Holden

                      Comment


                      • #12
                        Re: Calling Java from RPGLE

                        Yup, signed off and back on.

                        Here is what the messages says in my job log:

                        Message . . . . : The java.version property was detected as input. This
                        property is used as output only and has no effect on JVM initialization.
                        Cause . . . . . : java.version was specified as an input property to the
                        startup of the Java Virtual Machine (JVM). The Classic JVM supported
                        java.version as an input property for controlling selection of which Java
                        Developer Kit (JDK) to use. The IBM Technology for Java JVM only uses
                        java.version as an output property. Selection of a specific IBM Technology
                        for Java JVM/JDK combination is supported through setting the JAVA_HOME
                        environment variable.

                        Here is the message right before it:

                        Message . . . . : JVM properties were loaded from a properties file.
                        Cause . . . . . : The Java Virtual Machine used the file
                        "/QIBM/UserData/Java400/SystemDefault.properties" for loading one or more
                        properties.
                        Recovery . . . : If you are encountering property errors within your Java
                        Virtual Machine, you should check this file for accuracy or delete it.

                        Comment


                        • #13
                          Re: Calling Java from RPGLE

                          Do you have a program trying to set the Java version with an ADDENVVAR command?

                          Comment


                          • #14
                            Re: Calling Java from RPGLE

                            Also, here are the contents of our "/qibm/userdata/java400/SystemDefault.properties" file:

                            java.version=1.5
                            sun.net.inetaddr.ttl=10

                            Comment


                            • #15
                              Re: Calling Java from RPGLE

                              And are all the Java methods your calling version 1.5 or lower? I only ask because this got me early last week, needless to say my SystemDefault.properties file had version 1.3 while I was using methods that were at least 1.5.

                              Comment

                              Working...
                              X