Suppressing the “Picked up _JAVA_OPTIONS” message [closed]

谁说胖子不能爱 提交于 2019-11-26 09:41:10

问题


I\'m using _JAVA_OPTIONS to set some defaults for Java on RHEL. It works fine but now every time I start java I get the following message

Picked up _JAVA_OPTIONS: -foo -bar -baz

is it possible to keep the options but suppress the display of this message.


回答1:


From looking at the relevant source code (arguments.cpp in openjdk, line 2492), there is no way to control the output of this message.

The only thing I could say is that it is printed to stderr. So you could wrap your commands to redirect stderr to /dev/null (if there wasn't anything else you cared about on stderr).

  • Or write a java wrapper script which filtered out this message.
  • Or submit a feature request to the openjdk project, although this won't solve your immediate problem.



回答2:


Where is _JAVA_OPTIONS being set? In your .bashrc?

Use an alias instead, e.g.

alias java="`which java` -Dwhatever"

Actually, it is not necessary to know where it is being set to make this work:

_SILENT_JAVA_OPTIONS="$_JAVA_OPTIONS"
unset _JAVA_OPTIONS
alias java='java "$_SILENT_JAVA_OPTIONS"'


来源:https://stackoverflow.com/questions/11683715/suppressing-the-picked-up-java-options-message

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!