×

Good News Everybody!

The new search engine is LIVE!

Please report any problems to david (at) midrange.com.




I've also been to hell and back trying to debug Java programs on the AS400 
but I finally got it to work.  I was calling a Java program from RPG, and 
I wanted to debug the Java code that was being remotely called from the 
RPG.  I was using STRSRVJOB on another session so that I could remotely 
debug the Java code.  I needed to be able to debug my Java class on the 
AS400, not on a Windows box running a remote debugger.

What I found out was the following:

When you try to debug a Java class using the STRDBG command on the AS400, 
the command doesn't work unless the JVM is already running and your class 
is loaded. 

I found that I was constantly getting the error 'Java class file not 
available.' I even tried the full pathname (eg. /home/myjava.class) but it 
didn't work even though I did have my environment CLASSPATH variable set 
properly.   I pressed F1 to get a further explanation on the error and 
found out that the reason code returned was 1 for '1 - Java virtual 
machine not started.'.

Once my RPG program was loaded and had started the copy of my Java class, 
I was then able to debug the Java Code, since the JVM was now running.  I 
also learned quickly that you have to match exactly, the name of the class 
in the STRDBG command matching upper and lower-case characters.  As well, 
you don't enter in the extension of class.  So my class name 
'OraCon.class' was entered in as OraCon.

Another trick I used was to set a breakpoint in my RPG code to break at 
the point where the Java class was instantiated.  Once the program hit 
this breakpoint, I then used F14 from within STRDBG and added the Java 
Class right after it was created.  I was then able to use Option 5 
'Display Module Source' and then set a break point in my Java code and 
then step through my Java class.


...Paul

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2026 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.