While installing Android Studio, it installed Jayatana as a dependency. Now when I ran java, it showed me a message as: Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar

I uninstalled the jayatana package, but the message didn't disappear. So I unset the environment variable using unset JAVA_TOOL_OPTIONS but this only stays for a bash session. If I close and reopen the shell, the variable is back. I have looked into the .bashrc, .profile, /etc/profile, /etc/bash.bashrc files and I couldn't find this variable defined anywhere.

Is there a way to permanently unset this environment variable? Or to find where it is defined?

  • How did you install and remove jayatana? If you did it using apt-get it should have removed anything it installed, but if there is a bug in the package, you may need to apt-get remove --purge jayatana -- if that helps, file a bug against the package. – tripleee Mar 11 '15 at 7:07
  • @tripleee I did not install jayatana. It got installed along with Android Studio by Ubuntu Make. I did not purge it while removal, but the package did uninstall successfully. I just needed to log out and back in for the unset command to show permanent change, as I discovered later. – Pawan Mar 11 '15 at 7:16

To find which file defines JAVA_TOOL_OPTIONS, run this:

PS4='+ $BASH_SOURCE:$LINENO:' BASH_XTRACEFD=7 bash -xlic ""  7>trace.out

The above command turns on diagnostics and saves the diagnostic output to trace.out. (For an explanation of how it works, click here.) When the command is done, run:

grep JAVA_TOOL_OPTIONS trace.out

This will show you which file defines JAVA_TOOL_OPTIONS and the line number in that file which does it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.