英文:
Java compilation through command prompt issue
问题
我尝试使用javac命令将我的类文件“checker.class”编译成“checker.java”,计划用java命令运行它,但是javac要么给我“文件未找到”的问题,要么给我“无效的标志”(当我试图将checker放在引号中时)。
我还想更好地理解问题本身,而不仅仅是知道解决方案。谢谢。
我的尝试:
C:\Users\jaede\Desktop\everything>javac checker.class
C:\Users\jaede\Desktop\everything>javac "checker.class"
带有错误消息的结果:
-
错误:未找到文件:Checker.java
用法:javac <选项> <源文件>
使用--help获取可能选项的列表 -
错误:无效的标志:Checker.class
用法:javac <选项> <源文件>
使用--help获取可能选项的列表
计划执行:
C:\Users\jaede\Desktop\everything>java checker.java
*附注:我可能没有环境变量问题,因为我可以用java命令运行另一个.java文件
英文:
I tried to compile my class file "checker.class" into "checker.java" through the use of the javac command, planning to run it with the java command, but javac either gave me the issue of "file not found" OR "invalid flag" (when I tried to put checker in quotations.)
I would also like to understand the issue itself better and not just know the solution. Thanks.
What I attempted:
C:\Users\jaede\Desktop\everything>javac checker.class
C:\Users\jaede\Desktop\everything>javac "checker.class"
Results with error messages:
-
error: file not found: Checker.java
Usage: javac <options> <source files>
use --help for a list of possible options -
error: invalid flag: Checker.class Usage: javac <options> <source files>
use --help for a list of possible options
planned to do:
C:\Users\jaede\Desktop\everything>java checker.java
*Sidenote: I probably do not have an environment variable issue, since I could run this with another .java files with the java command
答案1
得分: 0
我混淆了 .class 和 .java。原帖的评论中有详细的说明。
英文:
I got .class and .java mixed up. The comments to the original post have the full rundown.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论