1. 程式人生 > >如何解決Mac下Class JavaLaunchHelper is implemented in both的錯誤

如何解決Mac下Class JavaLaunchHelper is implemented in both的錯誤

在執行程式的時候,經常會在控制檯頂部出現如下錯誤:

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

或者

objc[19990]: Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.8.0_102.jdk/Contents/Home/bin/java (0x1060b54c0) and /Library/Java/JavaVirtualMachines/jdk1.8.0_102.jdk/Contents/Home/jre/lib/libinstrument.dylib (0x1061e04e0). One of the two will be used. Which one is undefined.

雖然不影響程式的執行,但是強迫症犯了,必須解決,Google了一下,發現stactoverflower上面已經有解決方案:
附上鍊接:

objc3648-class-javalaunchhelper-is-implemented-in-both
在idea中,點選Help –> Edit Custom Properties,開啟編輯配置檔案,如果從來沒編輯過則提示檔案不存在,是否建立,點建立就好了。
然後在對話視窗中輸入:

#http://stackoverflow.com/questions/43003012/objc3648-class-javalaunchhelper-is-implemented-in-both
idea.no.launcher=true

然後關閉IDEA,重新開啟,再次執行後依舊發現還有這個錯誤。接著往下看發現如下回答:

I am using Intellij Idea 2017 and I got into the same problem. What solved the problem for me was to simply

close the project in intelliJ
File -> New -> project from existing resources
use Import from external model (if any)
open the project again.

那麼只需要重新匯入一下專案即可。