类JavaLaunchHelper在…libinstrument.dylib中实现。两者中的一个将被使用。哪一个是未定义的

时间:2021-09-22 15:00:12

I upgraded to the latest Java 7 u40 on MacOS X and started getting the following message on the console when launching my application using Eclipse. The app works fine but I would like to find out the cause of the problem and hopefully a fix for it.

我在MacOS X上升级到最新的Java 7 u40,并在使用Eclipse启动应用程序时开始在控制台获得以下消息。这款应用程序运行良好,但我想找出问题的原因,并希望解决它。

objc[10012]: Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.7.0_40.jdk/Contents/Home/bin/java and /Library/Java/JavaVirtualMachines/jdk1.7.0_40.jdk/Contents/Home/jre/lib/libinstrument.dylib. One of the two will be used. Which one is undefined.

Does anyone know why this message is printed and how to fix it?

有人知道为什么要打印这条消息吗?

11 个解决方案

#1


142  

For JetBrains IntelliJ IDEA: Go to Help -> Edit Custom Properties.... Create the file if it asks you to create it. To disable the error message paste the following to the file you created:

JetBrains IntelliJ IDEA:去帮助- >编辑自定义属性....如果文件要求您创建文件,请创建它。要禁用错误消息,请将以下内容粘贴到您创建的文件:

idea_rt
idea.no.launcher=true

This will take effect on the next restart of the IntelliJ.

这将在IntelliJ的下一次重启时生效。

#2


108  

As of October 2017, this issue is now resolved in

从2017年10月开始,这一问题将在2017年10月得到解决

#3


17  

  1. Install Java 7u21 from here: http://www.oracle.com/technetwork/java/javase/downloads/java-archive-downloads-javase7-521261.html#jdk-7u21-oth-JPR

    从这里安装Java 7u21: http://www.oracle.com/technetwork/java/javase/downloads/java- archise -javase7-521261.html#jdk-7u21-oth-JPR

  2. set these variables:

    设置这些变量:

    export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_21.jdk/Contents/Home
    export PATH=$JAVA_HOME/bin:$PATH
    
  3. Run your app and fun :)

    运行你的应用程序,乐趣:)

#4


11  

Copy Pasting @Lichtamberg's comments to gotoalberto's answer

复制粘贴@Lichtamberg的评论到gotoalberto的答案。

Works also for Java 1.8:

同样适用于Java 1.8:

# in ~/.zshrc and ~/.bashrc

export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home 
export PATH=$JAVA_HOME/bin:$PATH 

This fixed my issue on java 8.

这解决了我关于java 8的问题。

#5


5  

Not sure if this is the cause of the problem, but I got this issue only after installing JVM Monitor.

不确定这是否是问题的原因,但我是在安装JVM Monitor之后才遇到这个问题的。

Uninstalling JVM Monitor solved the issue for me.

卸载JVM Monitor为我解决了这个问题。

#6


4  

As other answers detail, this is a bug in the JDK (up to u45) which will be fixed in JDK7u60 - while this is not out yet, you may download the b01 from here:

作为其他详细的回答,这是JDK中的一个bug(最多是u45),它将在JDK7u60中得到修复——虽然这还没有发布,但是您可以从这里下载b01:

https://jdk7.java.net/download.html

https://jdk7.java.net/download.html

It's beta, but fixed that issue for me.

这是beta版,但我解决了这个问题。

#7


2  

https://groups.google.com/forum/#!topic/google-appengine-*/QZGJg2tlfA4

https://groups.google.com/forum/ # ! / google-appengine-* / QZGJg2tlfA4话题

From what I've found online, this is a bug introduced in JDK 1.7.0_45. I've read it will be fixed in the next release of Java, but it's not out yet. Supposedly, it was fixed in 1.7.0_60b01, but I can't find where to download it and 1.7.0_60b02 re-introduces the bug.

根据我在网上发现的,这是JDK 1.7.0_45中引入的一个bug。我读过它将在Java的下一个版本中被修复,但是它还没有发布。据推测,它是在1.7.0_60b01中修复的,但是我找不到下载的地方,1.7.0_60b02重新引入了这个bug。

I managed to get around the problem by reverting back to JDK 1.7.0_25. Probably not the solution you wanted, but it's the only way I've been able to get it working. Don't forget add JDK 1.7.0_25 in Eclipse after installing the JDK.

我通过恢复到JDK 1.7.0_25解决了这个问题。可能不是你想要的解决方案,但这是我能让它工作的唯一方法。不要忘记在安装JDK之后在Eclipse中添加JDK 1.7.0_25。

Please DO NOT REPLY directly to this email but go to *: Class JavaLaunchHelper is implemented in both. One of the two will be used. Which one is undefined

请不要直接回复这封邮件,而是去*:在两个版本中都实现了JavaLaunchHelper类。两者中的一个将被使用。哪一个是未定义的

#8


1  

To solve this issue, I downgraded to JDK version 1.7.0_21. then I used this little bash script to change the version I use.

为了解决这个问题,我将其降级为JDK 1.7.0_21。然后我使用这个小bash脚本更改我使用的版本。

function setjdk() {
  if [ $# -ne 0 ]; then
   removeFromPath '/System/Library/Frameworks/JavaVM.framework/Home/bin'
   if [ -n "${JAVA_HOME+x}" ]; then
    removeFromPath $JAVA_HOME
   fi
   export JAVA_HOME=`/usr/libexec/java_home -v $@`
   export PATH=$JAVA_HOME/bin:$PATH
  fi
 }

 function removeFromPath() {
  export PATH=$(echo $PATH | sed -E -e "s;:$1;;" -e "s;$1:?;;")
 }

Once you have the bash script in your zshrc/bshrc file - just call setJdk 1.7.0_21 and you're good to go.

一旦在zshrc/bshrc文件中有了bash脚本,只需调用setJdk 1.7.0_21,就可以开始了。

#9


0  

Well, after some struggling, what worked for me was completely removing the current JDK, as described here:

在经历了一些挣扎之后,对我起作用的是完全删除当前的JDK,正如这里所描述的:

sudo rm -rf /Library/Java/JavaVirtualMachines/jdk1.7.0_80.jdk
sudo rm -rf /Library/PreferencePanes/JavaControlPanel.prefPane
sudo rm -rf /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin
sudo rm -rf /Library/LaunchAgents/com.oracle.java.Java-Updater.plist
sudo rm -rf /Library/PrivilegedHelperTools/com.oracle.java.JavaUpdateHelper
sudo rm -rf /Library/LaunchDaemons/com.oracle.java.JavaUpdateHelper.plist
sudo rm -rf /Library/Preferences/com.oracle.java.Helper-Tool.plist

Then installed 1.7.0_21, after downloaded from here.

然后从这里下载后安装1.7.0_21。

Now a java -version prompts:

现在java版本提示:

java version "1.7.0_21"
Java(TM) SE Runtime Environment (build 1.7.0_21-b12)
Java HotSpot(TM) 64-Bit Server VM (build 23.21-b01, mixed mode)

#10


-1  

If you're using IntelliJ & Mac just go to Project structure -> SDK and make sure that there is Java listed but it points to sth like

如果你用的是IntelliJ & Mac,你只要去到项目结构> SDK,确保有Java列表,但是它指向一些类似的东西

/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home

Rather than user home...

而不是用户家里……

#11


-3  

jdk-7u80-macosx-x64.dmg fix this problem.

jdk-7u80-macosx-x64。dmg解决这个问题。

#1


142  

For JetBrains IntelliJ IDEA: Go to Help -> Edit Custom Properties.... Create the file if it asks you to create it. To disable the error message paste the following to the file you created:

JetBrains IntelliJ IDEA:去帮助- >编辑自定义属性....如果文件要求您创建文件,请创建它。要禁用错误消息,请将以下内容粘贴到您创建的文件:

idea_rt
idea.no.launcher=true

This will take effect on the next restart of the IntelliJ.

这将在IntelliJ的下一次重启时生效。

#2


108  

As of October 2017, this issue is now resolved in

从2017年10月开始,这一问题将在2017年10月得到解决

#3


17  

  1. Install Java 7u21 from here: http://www.oracle.com/technetwork/java/javase/downloads/java-archive-downloads-javase7-521261.html#jdk-7u21-oth-JPR

    从这里安装Java 7u21: http://www.oracle.com/technetwork/java/javase/downloads/java- archise -javase7-521261.html#jdk-7u21-oth-JPR

  2. set these variables:

    设置这些变量:

    export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_21.jdk/Contents/Home
    export PATH=$JAVA_HOME/bin:$PATH
    
  3. Run your app and fun :)

    运行你的应用程序,乐趣:)

#4


11  

Copy Pasting @Lichtamberg's comments to gotoalberto's answer

复制粘贴@Lichtamberg的评论到gotoalberto的答案。

Works also for Java 1.8:

同样适用于Java 1.8:

# in ~/.zshrc and ~/.bashrc

export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home 
export PATH=$JAVA_HOME/bin:$PATH 

This fixed my issue on java 8.

这解决了我关于java 8的问题。

#5


5  

Not sure if this is the cause of the problem, but I got this issue only after installing JVM Monitor.

不确定这是否是问题的原因,但我是在安装JVM Monitor之后才遇到这个问题的。

Uninstalling JVM Monitor solved the issue for me.

卸载JVM Monitor为我解决了这个问题。

#6


4  

As other answers detail, this is a bug in the JDK (up to u45) which will be fixed in JDK7u60 - while this is not out yet, you may download the b01 from here:

作为其他详细的回答,这是JDK中的一个bug(最多是u45),它将在JDK7u60中得到修复——虽然这还没有发布,但是您可以从这里下载b01:

https://jdk7.java.net/download.html

https://jdk7.java.net/download.html

It's beta, but fixed that issue for me.

这是beta版,但我解决了这个问题。

#7


2  

https://groups.google.com/forum/#!topic/google-appengine-*/QZGJg2tlfA4

https://groups.google.com/forum/ # ! / google-appengine-* / QZGJg2tlfA4话题

From what I've found online, this is a bug introduced in JDK 1.7.0_45. I've read it will be fixed in the next release of Java, but it's not out yet. Supposedly, it was fixed in 1.7.0_60b01, but I can't find where to download it and 1.7.0_60b02 re-introduces the bug.

根据我在网上发现的,这是JDK 1.7.0_45中引入的一个bug。我读过它将在Java的下一个版本中被修复,但是它还没有发布。据推测,它是在1.7.0_60b01中修复的,但是我找不到下载的地方,1.7.0_60b02重新引入了这个bug。

I managed to get around the problem by reverting back to JDK 1.7.0_25. Probably not the solution you wanted, but it's the only way I've been able to get it working. Don't forget add JDK 1.7.0_25 in Eclipse after installing the JDK.

我通过恢复到JDK 1.7.0_25解决了这个问题。可能不是你想要的解决方案,但这是我能让它工作的唯一方法。不要忘记在安装JDK之后在Eclipse中添加JDK 1.7.0_25。

Please DO NOT REPLY directly to this email but go to *: Class JavaLaunchHelper is implemented in both. One of the two will be used. Which one is undefined

请不要直接回复这封邮件,而是去*:在两个版本中都实现了JavaLaunchHelper类。两者中的一个将被使用。哪一个是未定义的

#8


1  

To solve this issue, I downgraded to JDK version 1.7.0_21. then I used this little bash script to change the version I use.

为了解决这个问题,我将其降级为JDK 1.7.0_21。然后我使用这个小bash脚本更改我使用的版本。

function setjdk() {
  if [ $# -ne 0 ]; then
   removeFromPath '/System/Library/Frameworks/JavaVM.framework/Home/bin'
   if [ -n "${JAVA_HOME+x}" ]; then
    removeFromPath $JAVA_HOME
   fi
   export JAVA_HOME=`/usr/libexec/java_home -v $@`
   export PATH=$JAVA_HOME/bin:$PATH
  fi
 }

 function removeFromPath() {
  export PATH=$(echo $PATH | sed -E -e "s;:$1;;" -e "s;$1:?;;")
 }

Once you have the bash script in your zshrc/bshrc file - just call setJdk 1.7.0_21 and you're good to go.

一旦在zshrc/bshrc文件中有了bash脚本,只需调用setJdk 1.7.0_21,就可以开始了。

#9


0  

Well, after some struggling, what worked for me was completely removing the current JDK, as described here:

在经历了一些挣扎之后,对我起作用的是完全删除当前的JDK,正如这里所描述的:

sudo rm -rf /Library/Java/JavaVirtualMachines/jdk1.7.0_80.jdk
sudo rm -rf /Library/PreferencePanes/JavaControlPanel.prefPane
sudo rm -rf /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin
sudo rm -rf /Library/LaunchAgents/com.oracle.java.Java-Updater.plist
sudo rm -rf /Library/PrivilegedHelperTools/com.oracle.java.JavaUpdateHelper
sudo rm -rf /Library/LaunchDaemons/com.oracle.java.JavaUpdateHelper.plist
sudo rm -rf /Library/Preferences/com.oracle.java.Helper-Tool.plist

Then installed 1.7.0_21, after downloaded from here.

然后从这里下载后安装1.7.0_21。

Now a java -version prompts:

现在java版本提示:

java version "1.7.0_21"
Java(TM) SE Runtime Environment (build 1.7.0_21-b12)
Java HotSpot(TM) 64-Bit Server VM (build 23.21-b01, mixed mode)

#10


-1  

If you're using IntelliJ & Mac just go to Project structure -> SDK and make sure that there is Java listed but it points to sth like

如果你用的是IntelliJ & Mac,你只要去到项目结构> SDK,确保有Java列表,但是它指向一些类似的东西

/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home

Rather than user home...

而不是用户家里……

#11


-3  

jdk-7u80-macosx-x64.dmg fix this problem.

jdk-7u80-macosx-x64。dmg解决这个问题。