Java Debugger launches application without hacking

I have the ubiquitous HelloWorldApp.java file

/**
 * The HelloWorldApp class implements an application that
 * simply prints "Hello World!" to standard output.
 */
class HelloWorldApp {
    public static void main(String[] args) {
        System.out.println("Hello World!");
    }
}

I run:

javac HelloWorldApp.java

then I run:

jdb HelloWorldApp

I get:

Initializing jdb ...
> 

I am typing:

stop at HelloWorldApp.main:7

where will be offered

then i get

Deferring breakpoint HelloWorldApp.main:7.
It will be set after the class is loaded.
>

I am typing:

run

where will be offered

then i get

Set uncaught java.lang.Throwable
Set deferred uncaught java.lang.Throwable
> 
VM Started: Hello World!

The application exited

I didn’t enter anything in this last invitation, he just left without breaking. My question is why did he output these Throwable lines and why didn't the debugger stop at the breakpoint I gave it?

+4
source share
1 answer

I just checked the stop syntax in the JDB documentation

stop in <class-name>.<method-name>  Stop on entry to the given method.
stop at <class-name>:<line-number>  Stop at the given line.

I think the stop command should be either one of the following

stop in HelloWorldApp.main 
stop at HelloWorldApp:7

Try to see what fixes your problem!

+5
source

Source: https://habr.com/ru/post/1598524/


All Articles