H2ONaCl H2ONaCl - 1 year ago 80
Java Question

javaagent option does not expand the tilde but why not

This invocation works.

java -ea -cp ~/Documents/workspace/export/testProject1/"*" -javaagent:/home/jack/Documents/workspace/export/testProject1/SizeOf.jar testProject1.Tester

This invocation fails.

java -ea -cp ~/Documents/workspace/export/testProject1/"*" -javaagent:~/Documents/workspace/export/testProject1/SizeOf.jar testProject1.Tester

The failure looks like this.

Error opening zip file or JAR manifest missing :
Error occurred during initialization of VM
agent library failed to init: instrument

Why does the the
option fail to expand the tilde (
). This was on Linux.

Answer Source

The tilde is expanded by the shell, not the program being run, and it wasn't at the beginning of the token. Use "$HOME" instead.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download