Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

java

scala

ubuntu

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
like image 275
corazza Avatar asked Sep 27 '14 12:09

corazza


People also ask

What is picked up _JAVA_OPTIONS?

If Using Ubuntu 16.04, Check etc/profile there you may find _JAVA_OPTIONS: -Xmx256M set. That's a file where environment variables are set for the whole. I assume you are facing this message for every java application you run. Although there are other ways to set environment variables.

Where is Java_tool_options?

There is a JAVA_TOOL_OPTIONS environment variable, that can be set in the /etc/profile. d for all users.

How do you unset a java option?

Remove _JAVA_OPTIONS on Windows: 1) Open the Start menu and enter the phrase "System" in the search, open the program with the same name. 3) In the two lists, check whether there is _JAVA_OPTIONS, when you find a highlight variable and click "Delete." Save your changes by clicking on OK.

What is _JAVA_OPTIONS in environment variable?

You can use _JAVA_OPTIONS to pass options to any JVM process started on your system. For example, set _JAVA_OPTIONS=-Dsun.java2d.noddraw=true. When a JVM starts, it parses the value of _JAVA_OPTIONS as if the parameters were at the command line of java. You can see the passed parameters via JVisualVM.


2 Answers

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.

like image 157
Kim Stebel Avatar answered Oct 06 '22 01:10

Kim Stebel


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.

like image 32
Richard Wеrеzaк Avatar answered Oct 06 '22 01:10

Richard Wеrеzaк