mac 上 class javalaunchhelper is implemented in both 报错

在macOS上IntelliJ上导入flowdroid的maven项目运行时报错如下

Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/bin/java (0x10d19c4c0) and /Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/lib/libinstrument.dylib (0x10ea194e0). One of the two will be used. Which one is undefined.

原因

这是Mac上面Java的一个老Bug了,会在那些使用了Java Agent的IDE上运行应用时触发,但这个Error对程序是无影响的,可以无视。在Java 9和Java 1.8.152版本里已经修复了。

解决办法

点击IntelliJ最上面菜单

Help-Edit Custom Properties

没有这个properties文件的话,IJ会提示创建,然后在里面加上

idea.no.launcher=true