java javac 无效标志

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6626824/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-30 16:42:02  来源:igfitidea点击:

javac invalid flag

javabuildjavacmatlab-deployment

提问by Nick

I was trying to execute this command in command prompt to find my build error. What I have broken down upto is that javac is treating one of the file name as a flag (option) and thats why its not able to execute. HOw do i fix this?

我试图在命令提示符下执行此命令以查找我的构建错误。我所分解的是 javac 将文件名之一视为标志(选项),这就是它无法执行的原因。我该如何解决?

C:\Users\AUG>javac -verbose -classpath "C:\Program Files\MATLAB\R2010b\toolbox\j
avabuilder\jar\javabuilder.jar" -d "C:\Users\AUG\Documents\SourceTraceJAVA\Sourc
eTrace\src\classes" "C:\Users\AUG\Documents\SourceTraceJAVA\epanet2.h" "C:\Users
\AUG\Documents\SourceTrace\src\SourceTrace\SourceTrace.java" "C:\Users\AUG\Docum
ents\SourceTraceJAVA\SourceTrace\src\SourceTrace\SourceTraceMCRFactory.java" "C:
\Users\AUG\Documents\SourceTraceJAVA\SourceTrace\src\SourceTrace\SourceTraceRemo
te.java" "C:\Users\AUG\Documents\SourceTraceJAVA\SourceTrace\src\SourceTrace\pac
kage-info.java"
javac: invalid flag: C:\Users\AUG\Documents\SourceTraceJAVA\epanet2.h
Usage: javac <options> <source files>
use -help for a list of possible options

It is considering epanet2.h file as a flag instead of a file. Is there somethng wrong with the syntax ? How do I resolve this?

它将 epanet2.h 文件视为标志而不是文件。语法有问题吗?我该如何解决?

回答by Liv

Java doesn't know what to do with .hfiles -- that looks (based on extension) like a C header file so it shouldn't be included in the list of files passed to javacor if it is a valid java source file then change its extension to .java.

Java 不知道如何处理.h文件——它看起来(基于扩展名)像一个 C 头文件,所以它不应该包含在传递给的文件列表中,javac或者如果它是一个有效的 Java 源文件然后更改它的扩展到.java.

回答by Karl-Bj?rnar ?ie

*.his not a valid java source file extension.

*.h不是有效的 java 源文件扩展名。