"Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar" when starting the Scala interpreter

When running the Scala interpreter in Ubuntu 14.04, I get the following message printed as the first line:

Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar 

Followed by the familiar "Welcome to Scala" message.

I'm worried because I haven't seen that when running Scala before - what does it mean, is it dangerous, etc?

Apparently the environment variable $JAVA_TOOL_OPTIONS is set to -javaagent:/usr/share/java/jayatanaag.jar - I didn't set that, but what did and why? Can I safely unset it?

Additional info:

  • recently installed Android Studio
  • The word "ayatana" in the JAR's name might point to Ubuntu's project Ayatana

Solution 1:

You can disable jayatana just for the current shell session by unsetting JAVA_TOOL_OPTIONS like so:

unset JAVA_TOOL_OPTIONS

That way it will still be enabled for applications needing it.

Solution 2:

This occurs if you have installed jayatana which allows the hidden global menu in eclipse to work with Unity:

sudo add-apt-repository ppa:danjaredg/jayatana
sudo apt-get update
sudo apt-get install jayatana

that puts JARs in the /usr/share/java/ folder which is echoed by the JVM when starting up.

If you remove that software, you will not see the message:

sudo apt-get remove jayatana

You may have to delete:

/usr/share/upstart/sessions/jayatana.conf 

and restart your session so that the environment variable JAVA_TOOL_OPTIONS is not set.

Solution 3:

This is because of Jayatana, which is added to Ubuntu 15.04 in order to enable global menu for Java Swing applications. You can safely remove this message by entering the following command in a terminal. This command will remove the auto-start configuration of Jayatana.

sudo rm /usr/share/upstart/sessions/jayatana.conf

However, removing this option will disable the global menu support of Java Swing applications like Netbeans, IntelliJ IDEA. I have shared my workaround to suppress the message without losing the global menu in this article: Global Menu Support for Java Applications

Solution 4:

On Windows, set JAVA_TOOL_OPTIONS=

Setting to null will remove it from the environment.

Solution 5:

If you are using Windows OS, goto environment variables and delete or set to null the varible JAVA_TOOL_OPTIONS.