Run java application on iSeries

Hi Experts,  I am running a simple HelloWorld java program on iSeries.  I am able to run it, but I don't see any output.  It just displayes a $ sign.  How would I see the output?  Thanks in advance.
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

MurpheyConnect With a Mentor Commented:
What will happen if you run it from a AS/400 command line?

with the RUNJVAPGM command type RUNJVAPGM and press F4 to prompt.

(before running you have to change to the rught path with  CD '/myprogrampath/'

Gary PattersonConnect With a Mentor VP Technology / Senior Consultant Commented:
Post the code.  

Remember that the AS/400 is a console-mode java client only, so you can't run Swing, for example, since there is no GUI on the AS/400.

This will work:

class HelloWorldApp {
    public static void main(String[] args) {
        System.out.println("Hello World!"); // Display the string.

How, exactly are you running it?  Though QShell?

> java HelloWorld

This won't work:

import javax.swing.JFrame;
import javax.swing.JLabel;

public class HelloWorldSwing {
  public static void main(String[] args) {
    JFrame frame = new JFrame("HelloWorldSwing");
    final JLabel label = new JLabel("Hello World");


Open in new window

sbmahapatraAuthor Commented:
Hi Gary,
I doing exactly what you listed.  Here is the attachment.  In fact I have two classes.  1.  HelloWorld and 2. Customer.  First I started with Customer class.  When had problem, I tried HelloWorld.  Thanks a lot.

Gary PattersonVP Technology / Senior Consultant Commented:
Only thing I can think of offhand is that something in your environment may be causing redirection of SDTOUT and/or STDERR somewhere.

Post the results from executing the QSH SET command to view your environment variable, and also post the contents of any global or personal .profile files:

While in your home directory:

CAT .profile
CAT /etc/profile

Also, if there is an environment variable called ENV declared, CAT the contents of the file that it references, too.

- Gary Patterson

sbmahapatraAuthor Commented:
Hi murphey2,  I am sorry, I could not try your solution, but will try soon.  As I tried so many things, but did not work out, so I had to give a pause to the project which is not vary important.  Thank you very much for your help.  I will check it and update you soon.
All Courses

From novice to tech pro — start learning today.