set args for JDB



我用来执行我的java代码的命令是:

java -cp /usr/local/share/java/dbus.jar:/usr/local/share/java/unix.jar:/usr/local/share/java/debug-disable.jar:. 
-Djava.library.path=/usr/local/lib/jniCaller3 org.freedesktop.DBus" "/org/freedesktop/DBus" "org.freedesktop.DBus" "Hello"

如何将ARG将其传递到JDB中?

~/jdbus> jdb Caller3
Initializing jdb ...
> 

现在呢?使用GDB,我将简单地使用 set args

> set args -cp /usr/local/share/java/dbus.jar:/usr/local/share/java/unix.jar:/usr/local/share/java/debug-disable.jar:. 
-Djava.library.path=/usr/local/lib/jni org.freedesktop.DBus" "/org/freedesktop/DBus" "org.freedesktop.DBus" "Hello"

您可以简单地将参数传递到JDB

> cat Code.java
public class Code {
  public static void main(String [] arg) {
    System.out.println(arg[0]);
  }
}
> javac Code.java
> java -cp . Code Hello
Hello
> jdb -classpath . Code hello
Initializing jdb ...
> run
run Code hello
Set uncaught java.lang.Throwable
Set deferred uncaught java.lang.Throwable
>
VM Started: hello
The application exited

相关内容

  • 没有找到相关文章

最新更新