H2ONaCl H2ONaCl - 8 months ago 25
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.


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.