解决ubuntu中JDK的Picked up JAVA_TOOL_OPTIONS提示问题。

有时间我会翻译成中文的

Java swing applications‘ menus do not integrate with Ubuntu‘s global menu until Ubuntu 15.04. A library calledJayatana is available to enable global menu support for Java swing applications in Ubuntu (From Ubuntu 15.04 Jayatana becomes a default library). There are hundreds of articles available about Jayatana, but this article has an additional hack to remove the irritating message, printed by Jayatana.
If you are an Ubuntu 15.04 user, jump here: Remove: Picked up JAVA_TOOL_OPTIONS Message

If you have not noticed any differences between Java swing applications and others, have a look at the following screenshots of Android Studio and Eclipse.

Android Studio without global menu support

Eclipse with global menu

To enable the global menu support, install the Jayatana using following commands in your terminal (Ctrl + Alt + T to start terminal).

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

Once you have successfully installed the software, logout and login to the system again. Now open any Java swing application, you will see the difference.

Remove: Picked up JAVA_TOOL_OPTIONS Message

Now open your terminal and enter the following command to check the version of Java.

java -version

You will get a message “Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar” just above the version information of Java. This message irritates me a lot, and confuses my students whenever I show practical demonstration to them in terminal. If this message does not bother you, simply ignore the rest of this article and spend your time in reading any other articles in this site.

The “Picked up JAVA_TOOL_OPTIONS” message can be removed by a simple hack, but with a cost of disabling automatic support of Jayatana for all the Java applications. Lets dirt your hands...

Step 1:

Enter the following command in the terminal to remove the “ Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar” message of Jayatana.

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

Now logout and login to the system and execute the same command to print the version of Java.

java -version

This time you will not get that annoying message. But, if you run any Java swing application, it will be returned to its old swing menu. Now you need to enable the global menu support for all the Java swing applications manually.

Step 2:

IntelliJ IDEA & Android Studio:
To enable the global menu support of Android Studio, enter the following command in terminal. In my case the Android Studio is installed in /opt/android-studio/ directory. Change the given command based on the location of your Android Studio or IntelliJ IDEA.

For Ubuntu 32bit:

sudo gedit /opt/android-studio/bin/studio.vmoptions

For Ubuntu 64bit:

sudo gedit /opt/android-studio/bin/studio64.vmoptions

At the end of the opened file, add the following line and save the file.

-javaagent:/usr/share/java/jayatanaag.jar

After the modification, the file should look like this:

NetBeans:

To enable the global menu for NetBeans, enter the following command in the Terminal. In my case the NetBeans is installed in /usr/local/netbeans-8.0.2 directory. Change the location in this command, based on the version and location of your NetBeans.

sudo gedit /usr/local/netbeans-8.0.2/etc/netbeans.conf

Search for netbeans_default_options in the opened file, and add the following statement at the end of the existing value. (Notice that the options are separated by space)

-J-javaagent:/usr/share/java/jayatanaag.jar

After the modification, the file should look like this:

Step 3:
Close the file and open your IDE (Android Studio/IntelliJ IDEA or NetBeans), you will see the magic.

For any Java swing applications, use the following command to enable the global menu integration.

java -jar -javaagent:/usr/share/java/jayatanaag.jar <file-name>

If you are using any other Java swing applications, change the configuration file of them by adding the command line parameter ‘-javaagent:/usr/share/java/jayatanaag.jar‘ to enable the global menu.

原文地址:http://www.javahelps.com/2015/06/global-menu-support-for-java.html#remove-jayatana-message

时间: 2024-10-13 10:32:42

解决ubuntu中JDK的Picked up JAVA_TOOL_OPTIONS提示问题。的相关文章

Ubuntu jdk报Picked up JAVA_TOOL_OPTIONS信息解决

下面是我在网上找了好久找到的: Ubuntu jdk报Picked up JAVA_TOOL_OPTIONS信息解决 Ubuntu下java一直报下面这句Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar. 大概看了下,是ubuntu自带的一个东西.删掉即可. sudo apt-get --purge remove jayatana 删了之后都不能编译了 然后通过 sudo apt-get --purge

【原创】Ubuntu jdk报Picked up JAVA_TOOL_OPTIONS信息解决

下面是我在网上找了好久找到的: Ubuntu jdk报Picked up JAVA_TOOL_OPTIONS信息解决 Ubuntu下java一直报下面这句Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar. 大概看了下,是ubuntu自带的一个东西.删掉即可. sudo apt-get --purge remove jayatana 然后我就日了狗了,妈的删了之后都不能编译了 然后通过 sudo apt-g

解决ubuntu中firefox浏览器总是提示找不到服务器的问题

这个情况在我机器上经常出现,而且时不时的给你出点问题,但是有些时候等一下就好了,或者把引擎换到百度的话它就又行得通了.. 被这个问题搞得很烦,上网查了下说是防火墙啊之类的出问题,但是自己弄了后这个问题还是经常出现,不过好好查了下资料还是发现了问题所在,感觉这脑袋真的挺笨的.. 如果在ping其他主机,本地地址等一些地址后都没问题的话,那应该就是dns域名解析出了问题了. 查看dns域名解析配置文件: $cat /etc/resolv.conf 比如我的是这个信息: # Dynamic resol

解决ubuntu中zip解压的中文乱码问题

在解压windows传过来的zip文件时,才会出现乱码.所以,我用另一个方法解决中文乱码问题. 安装 代码: sudo apt-get install unar 12.04以下或者想编译安装的朋友请参考: 使用 代码: lsar foo.zip #列出所有文件 如果列出的文件名已经正确 代码: unar foo.zip #解压所有文件 如果列出的文件名还不正确 代码: lsar -e GB18030 foo.zip #指定使用GB18030编码列出所有文件 unar -e GB18030 foo

怎样关掉 ubuntu 中的 System Program Problem Detected 提示框

怎样关掉 ubuntu 中的 System Program Problem Detected 提示框 方法如下:sudo gedit /etc/default/apport  打开该文件如下:# set this to 0 to disable apport, or to 1 to enable it# you can temporarily override this with# sudo service apport start force_start=1enabled=1 将 enable

解决ubuntu中vi不能正常使用方向键与退格键的问题

方案一: 问题: ubuntu中vi在编辑状态下方向键不能用,还有回格键不能删除等我们平时习惯的一些键都不能使用. 解决办法: 可以安装vim full版本,在full版本下键盘正常,安装好后同样使用vi命令. 安装vim: ubuntu预装的是vim tiny版本,而需要的是vim full版本.执行下面的语句安装vim full版本: sudo apt-get remove vim-common sudo apt-get install vim 这样就行了,vim是一款优秀的软件,可以在运用

解决Ubuntu中vi命令的编辑模式下不能正常使用键盘问题

在Ubuntu中,进入vi命令的编辑模式,发现按方向键不能移动光标,会输出ABCD,以及退格键也不能正常删除字符.这是由于Ubuntu预装的是vim-tiny,而我们需要使用vim-full,解决方法很简单,只需要以下两步: 步骤一,输入下述命令以卸载vim-tiny: sudo apt-get remove vim-common 1 1 步骤二,输入下述命令以安装vim-full: sudo apt-get install vim

解决Ubuntu中phpmyadmin对数据上传上限2M

本文部分参考自:http://www.myhack58.com/Article/sort099/sort0102/2011/29396.htm 原文有少量错误或者过时的(相对于ubuntu15来说)内容,已做修改. Ubuntu中php.ini的路径和其他linux不一样,路径为:/etc/php5/apache2/php.ini sudo gedit /etc/php5/apache2/php.ini 1.查找 post_max_size,指通过表单POST给PHP的所能接收的最大值,包括表单

解决ubuntu 中的eclipse 不支持gbk 编码问题

今天在ubuntu 下, 把Windows下工程导入Linux下Eclipse中,由于工程代码,是GBK编码,而Ubuntu默认不支持GBK编码,所以,要让Ubuntu支持GBK. 方法如下: 1.修改/var/lib/locales/supported.d/local文件,在文件中添加 zh_CN.GBK GBK zh_CN.GB2312 GB2312 2.sudo dpkg-reconfigure --force locales 然后在输出的结果中会出现 zh_CN.GB2312 done