Unconfigured Ad Widget

Collapse

Announcement

Collapse
No announcement yet.

Java Classpath problem! Help!

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

  • Guest's Avatar
    Guest replied
    Java Classpath problem! Help!

    We are trying to compile our first java program on the AS/400. We have installed all the licensed programs appropriately. After compiling the program, we try to execute it. This is where we get the error... Here's watz happening with QSH: QSH Command Entry $ > javac /rixjava/myFirstProgram.java $ > java /rixjava/myFirstProgram java.lang.NoClassDefFoundError: /rixjava/myFirstProgram $ Any help would be greatly appreciated!

    Leave a comment:


  • Guest's Avatar
    Guest replied
    Java Classpath problem! Help!

    Hi, I am experiencing the same kind of problem. I created the simple Hello.class No sweat right? (Even used CRTJVAPGM for optimization) Next I set a ENVVAR CLASSPATH to the IFS dir in which my freshly created class resides. There is NO WAY my AS400 looks at the classpath. If I use -verbose it only verifies the "QIBM/ProdData" stuff. Also using java -cp /"Path to class-file" Hello.class results in a class definition not found error. I have also tried to switch to the directory in which the class resides still no success. WHAT THE .... AM I DOING WRONG??????

    Leave a comment:


  • matt@minyard.org
    replied
    Java Classpath problem! Help!

    Try this: java -classpath /rixjava /rixjava/myFirstProgram Matt

    Leave a comment:


  • Guest's Avatar
    Guest replied
    Java Classpath problem! Help!

    Try the following from QSH: $
    cd /rixjava $ ls
    If you see myFirstProgram.class then try the following: $
    java myFirstProgram
    If you still get the same error then check myFirstProgram.java for a package statement. This is a common cause of the type of problem you are experiencing. If you have a package statement then the location of the class file must be in a directory hierarchy that resembles the package statement. For example, if your java file has: package rixjava; ...then try running it from the directory above rixjava with the following command: $
    java rixjava.myFirstProgram
    Also check to be sure you have a "public static void main(String[] args)" method defined in your .java file. This is the entry point for all Java programs run from the command line. Regards, Cliff

    Leave a comment:


  • Guest's Avatar
    Guest started a topic Java Classpath problem! Help!

    Java Classpath problem! Help!

    Here's a little CL program that sets your current directory and classpath then executes your program. Remember, Java is case sensitive. It's basically the same as the QSH approach ... just saves you time. Jim Quinlan AmericaII Corp St. Petersburg, Fl PGM CHGCURDIR DIR('/rixjava') ADDENVVAR ENVVAR(CLASSPATH) + VALUE('/rixjava:/home:/QIBM/ProdData/HTTP/Public+ /jt400/lib/jt400.jar:.:') RUNJVA CLASS(myFirstProgram) ENDPGM
Working...
X