Error when using javac: “javac: invalid flag: -s”

妖精的绣舞 提交于 2019-12-12 10:43:45

问题


I am trying to specify another version of JDK in maven-compiler-plugin. When -target and -source parameters are set to 1.5, everything is ok. But when i try to use 1.6 JDK, maven reports an error. Has anyone faced this problem?

Error:

Failure executing javac, but could not parse the error: javac: invalid flag: -s Usage: javac where possible options include: -g Generate all debugging info -g:none Generate no debugging info

Thanks.


回答1:


If you use 1.6 flag your JAVA_HOME should point to JDK 1.6.

Check it with java -version on a command line.

To define your JAVA_HOME do this:

Add to your ~/.bashrc this line:

export JAVA_HOME=$(/usr/libexec/java_home)

reference: http://www.mkyong.com/java/how-to-set-java_home-environment-variable-on-mac-os-x/



来源:https://stackoverflow.com/questions/11328677/error-when-using-javac-javac-invalid-flag-s

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