jdb doesn't work from TextPad

Using the Java SDK with TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
chatt
Posts: 23
Joined: Thu Aug 28, 2003 6:53 pm
Location: near Toronto
Contact:

jdb doesn't work from TextPad

Post by chatt »

Code: Select all

I can get jdb HelloWorld to work from the dos box but not as a TP command (customized tool).
In the XP SP2 dos box,
    E:\>java -version
    java version "1.4.2"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-b28)
    Java HotSpot(TM) Client VM (build 1.4.2-b28, mixed mode)
    
    E:\>cd E:\javaPackages\FoxInfoServer
    E:\javaPackages\FoxInfoServer>javac HelloWorldApp.java
    E:\javaPackages\FoxInfoServer>jdb HelloWorldApp
    Initializing jdb ...
    > run
    run HelloWorldApp
    Set uncaught java.lang.Throwable
    Set deferred uncaught java.lang.Throwable
    >
    VM Started: Hello World!
    "The application exited"

    Interestingly, a previous test ended instead with:
    "The application has been disconnected"
    
    This was run from: C:\j2sdk1.4.2\bin\jdb.exe HelloWorldApp
    but I can't swear whether it used javac or jikes (I thought it was javac).
    At present, the two compiler outputs run identically in TP.

    The PATH environ. var. seems to give C:\j2sdk1.4.2\bin\ priority:
        .;
        c:\PROGRA~1\jikes-1.22\bin;
        C:\WINDOWS;C:\WINDOWS\System32\Wbem;
        C:\SDCC\BIN;
        C:\PROGRA~1\Microsoft Visual Studio\Common\Tools\WinNT;
        C:\PROGRA~1\Microsoft Visual Studio\Common\MSDev98\Bin;
        C:\PROGRA~1\Microsoft Visual Studio\Common\Tools;
        C:\PROGRA~1\Microsoft Visual Studio\VC98\bin;
        C:\j2sdk1.4.2\bin;
        C:\PROGRA~1\Java\jre1.5.0_06\bin;
        ...

Whereas in a TP tools dialog:
    Command:        C:\j2sdk1.4.2\bin\jdb.exe
                    OR jdb
    Parameters:     $BaseName
    Initial Folder: $FileDir
        Initializing jdb ...
        > Internal exception:
        java.io.IOException: The handle is invalid
            at java.io.FileInputStream.readBytes(Native Method)
            at java.io.FileInputStream.read(FileInputStream.java:194)
            ...
        Tool completed successfully

Here's the code (formatting and comment NOT mine):
    class HelloWorldApp {
        public static void main(String[] args) {
            System.out.println("Hello World!"); // Display the string.
        }
    }
User avatar
Nicholas Jordan
Posts: 124
Joined: Mon Dec 20, 2004 12:33 am
Location: Central Texas ISO Latin-1
Contact:

Re: jdb doesn't work from TextPad

Post by Nicholas Jordan »

chatt: separate the code from the words of the post, the code tags are a little clumsy but that's a small price to pay for good help
chatt wrote:I can get jdb HelloWorld to work from the dos box but not as a TP command (customized tool).
In the XP SP2 dos box,

Code: Select all

E:\>java -version
    java version "1.4.2"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-b28)
    Java HotSpot(TM) Client VM (build 1.4.2-b28, mixed mode)
    
    E:\>cd E:\javaPackages\FoxInfoServer
    E:\javaPackages\FoxInfoServer>javac HelloWorldApp.java
    E:\javaPackages\FoxInfoServer>jdb HelloWorldApp
    Initializing jdb ...
    > run
    run HelloWorldApp
    Set uncaught java.lang.Throwable
    Set deferred uncaught java.lang.Throwable
    >

http://www.google.com/search?sourceid=n ... InfoServer did not match any docs.
This was run from: C:\j2sdk1.4.2\bin\jdb.exe HelloWorldApp but I can't swear whether it used javac or jikes (I thought it was javac).
Well run sufficient trials that you can report where the error is occuring.
The PATH environ. var. seems to give C:\j2sdk1.4.2\bin\ priority:
Priority ?

Code: Select all

     java.io.IOException: The handle is invalid
     at java.io.FileInputStream.readBytes(Native Method)
     at java.io.FileInputStream.read(FileInputStream.java:194)
Reading from standard in brings grief, read from a file.

Code: Select all

    class HelloWorldApp {
        public static void main(String[] args) {
            System.out.println("Hello World!"); // Display the string.
        }
    }
That's just a standard hello world. I quit using debuggers completely because of the same problems you are reporting, along with totally abandoning standard in ... System.out/System.in in java nomenclature.

Just seems to call into a 16 bit single threaded dll and hangs the entire box
User avatar
Nicholas Jordan
Posts: 124
Joined: Mon Dec 20, 2004 12:33 am
Location: Central Texas ISO Latin-1
Contact:

Post by Nicholas Jordan »

Debuggers are a wasteland - use a java.io.File object and set a boolean variable named debug by hand at an outer scope. This approach is given in "C++ Gotchas: Avoiding Common Problems in Coding and Design" by Stephen C Dewhurst.

Java is not cpp, but it is close enough that I now use the approach.

Dr. Dewhurst Steve has served as a principal on the ANSI/ISO C++ standardization committee, was the C++ training series adviser for Technology Exchange Company (Addison-Wesley), was a member of the editorial board of and columnist for C++ Report, and was co-founder and member of the editorial board of The C++ Journal. He has taught extensively in both university and commercial settings. He has also written C, COBOL, and Pascal compilers, was a principal on the ANSI/IEEE Pascal Standardization Committee, and a reviewer for ACM Computing Reviews.

screw debuggers
Post Reply