The JAR file containing the java class had been run through CRTJVAPGM
with option 10. The CLASS files were compiled with -g.
I'm guessing that the problem is that when I do a F22 it is trying to
step into to JNI layer, not my class. So if I could figure out how to
bring up my class before doing the F22 I could set a breakpoint stop
at it. Am I on the right track? or totally off base.
Brian, unfortunately, there are some debugging limitations when using
RPG and Java this way. Debugging of Java code isn't supported when the
JVM is running in the same process as the debugger. You will have to
debug from another job.
You also have to do CRTJVAPGM on the classes you want to debug. If you
don't do this, your Java breakpoints won't work the way you expect.
(You've already done this; I'm just putting this in for the record,
since it's an important step.)
You won't be able to step into the very first Java method. You'll have
to wait until the JVM is started by RPG. This doesn't happen until the
first Java method is called. If you do want to debug the first method,
you'll have to wait until the time you run your program, or insert a
call into your RPG program to some dummy method just to get the JVM
started.
0. CRTJVAPGM 'yourclass.class' (you only need to do this once after you
create the class)
1. From the RPG job:
a. ===> DSPJOB
b. Get the Name, User and Number - you will need this in the next
step (*)
2. From the debugging job:
a. ===> STRSRVJOB JOB(Number/User/Name)
b. ===> STRDBG yourRpgPgm
c. ===> Exit with F10.
3. From the RPG job, call your program.
4. Go back to the debugging job to step through your program.
5. From the debugging job:
a. ===> ENDDBG
b. ===> ENDSRVJOB JOB(whatever)
(*) Another, maybe easier, way to get the job info is to do WRKJOB
OPTION(*SPLF) in the RPG job, and do a 2 on one of the spoolfiles. Then
use cut-and-paste on all three job fields at once from the spoolfile to
the prompted STRSRVJOB command.
Another (newer) alternative to the green-screen debugger is the
graphical iSeries System Debugger:
http://www.eservercomputing.com/iseries/articles/index.asp?id=30
http://publib.boulder.ibm.com/iseries/v5r2/ic2924/index.htm?info/rzahh/sysdebug.htm
This is new in V5R2, but the article mentions a V5R1 PTF to use the
debugger there.
--
Karl Hanson
Barbara, thanks a bunch. I got this to "mostly" work! I was able to
step into the Java code but the source was not displayed. I could do
a F10 to step through and I could EVAL variable and see their content.
While this is a good step I still need to see the source. I was
wondering if maybe I need to compile differently or do something
special to make the source available.
I am compiling the source on Windows with "java -g" and placing all
the class files in a JAR. I copy the JAR file to the AS400 and run
CRTJVAPGM CLSF('JARNAME') OPTIMIZE(10). The JAR file and source files
are in the CLASSPATH.
FOLLOW-UP:
I tried a few things and was able to get the source to display.
Through trial-and-error I found that in order for the source to
display the CLASS file and JAVA file must be in the same directory and
cannot be in a JAR file. There may be some way to specify to the
debugger where the source is (if not with the CLASS file) but I didn't
see an obvious setting.