我用来执行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"
如何将args传递给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"
答案 0 :(得分:0)
您可以简单地将参数传递给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