ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

unable to compile HelloWorld.java

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

  • unable to compile HelloWorld.java

    Hello! I'm an AS400 novice, with an old v4r5 machine. I've managed to install the licenced programs "5769JC1 AS/400 Toolbox for Java" and "5769JV1 AS/400 Developer Kit for Java" from the os cds, but when it comes to trying to trying to running 'java' or 'javac' from a qsh, things don't proceed as I expect them to.

    > java com.ibm.as400.system.Hello
    ...results in...
    Java program completed with exit code 1
    ...which sounds like 'an error has occured' to me.

    Trying to check the java version...
    > java -version
    java: 001-0070 Exception JVAB544 not expected.
    ¢
    > java -showversion
    -showversion: argument not valid
    java: 001-0070 Exception JVAB544 not expected.
    ...kind of makes me think that the executable is there to be run, because it appears to be validating command line parameters, but it doesn't print the version number, and the JVAB544 error only appears a couple of times on Google with little to help.

    When creating my own HelloWorld.java, the javac compiler just seems to ignore it, and doesn't produce a class file...

    > cat HelloWorld.java
    class HelloWorld{ public static void main (String args[]) { System.out.println("Hello there world!"); } }
    ¢
    > javac HelloWorld.java
    ¢

    I think my classpath is set up ok...
    > set
    CLASSPATH=.;/usr/bin;QIBM/ProdData/HTTP/Public/jt400/lib

    (usr/bin is just a conveniently short path where I've dumped the hello world java file)

    I've googled and googled but seem to have hit a brick wall... any ideas what I could try? I think I've followed all the instructions to correctly install the licenced programs, but now I'm at a loss. Help!

    Thanks, Chris.

  • #2
    Re: unable to compile HelloWorld.java

    Change the ; in the classpath to : and try to compile again.
    Predictions are usually difficult, especially about the future. ~Yogi Berra

    Vertical Software Systems
    VSS.biz

    Comment


    • #3
      Re: unable to compile HelloWorld.java

      Originally posted by kpmac View Post
      Change the ; in the classpath to : and try to compile again.
      Oops! Yes, I did notice that soon after i made the original post. I changed the ; to : and I also added a leading / in front of the QIBM path. Still no luck. I think the JVAB544 error is more serious than a dodgy classpath, but I can't find any information on it anywhere. Any other ideas? Delete the licenced programs and try to reinstall again?

      Comment


      • #4
        Re: unable to compile HelloWorld.java

        I agree. Running java -version should work from the QShell command line no matter what current directory or classpath you have set. It sounds to me like the Java components themselves are not properly installed. Perhaps there is a component missing.

        I've just had a dig around and on our machine the Java message file is called QJVAMSGF. I was then able to display the text for your message.
        PHP Code:
        DSPMSGD RANGE(JVAB544MSGF(QJVAMSGF
        PHP Code:
        Message . . . . :   Unmonitored exception received.                          
        Cause . . . . . :   Received an unmonitored exception.                       
        Recovery  . . . :   See the messages listed on this display or in the job log
          
        (use the DSPJOBLOG command to display the job log).  Correct any errors and
          try 
        the command again
        So the error message is just an unhandled exception but nothing you have run so far would have a checked exception so it must be an unchecked runtime exception. I.E. something outside the scope of the program like an incorrectly loaded JVM.

        Googling that exception code I can see a couple of results talking about errors writing to stdout. Displaying hello world or a JVM version number will be attempting to write to standard out so my guess is the JVM doesn't know where to write to because it is not setup or installed properly.

        Sorry that's not much help. Just pointing out the obvious really.
        Ben

        Comment

        Working...
        X