1

The command I use to execute my Java code is:

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"

How can I pass the args into JDB?

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

Now what? With GDB I'd simply use 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"
jski
  • 685
  • 6
  • 14
  • You comman looks broken, because it does not contain a `Caller3`. Which is you main class in the command you call manually? `To the closing double quote at the end of this part `.../jniCaller3 org.freedesktop.DBus"` there is not opening one. – SubOptimal Jul 06 '17 at 09:00
  • Take a look here: http://www.owsiak.org/?p=2095 You can start you Java application and then, simply connect to it using jdb. – Oo.oO Jul 07 '17 at 02:22

1 Answers1

1

You can simply pass arguments into 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
Oo.oO
  • 12,464
  • 3
  • 23
  • 45