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?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Gary PattersonVP 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

MurpheyApplication ConsultantCommented:
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/'


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java App Servers

From novice to tech pro — start learning today.