简体   繁体   English

Java 编译通过命令提示符问题

[英]Java compilation through command prompt issue

我的错误尝试与我对 checker 所做的相同 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.我试图通过使用 javac 命令将我的 class 文件“checker.class”编译为“checker.java”,并计划使用 java 命令运行它,但是 javac 要么给了我“找不到文件”的问题,要么“无效标志”(当我试图将检查器放在引号中时。)我还想更好地了解问题本身,而不仅仅是知道解决方案。 Thanks.谢谢。

What I attempted:我尝试了什么:

C:\Users\jaede\Desktop\everything>javac checker.class C:\Users\jaede\Desktop\everything>javac checker.class

C:\Users\jaede\Desktop\everything>javac "checker.class" C:\Users\jaede\Desktop\everything>javac "checker.class"

Results with error messages:带有错误消息的结果:

  1. error: file not found: Checker.java Usage: javac use --help for a list of possible options错误:找不到文件:Checker.java 用法:javac 使用 --help 获取可能选项的列表

    1. error: invalid flag: Checker.class Usage: javac错误:无效标志:Checker.class 用法:javac

    use --help for a list of possible options使用 --help 获取可能选项的列表

planned to do:计划做:

C:\Users\jaede\Desktop\everything>java checker.java 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 *旁注:我可能没有环境变量问题,因为我可以使用 java 命令与另一个.java 文件一起运行它我预建的斐波那契数生成器。

I got.class and.java mixed up.我弄混了.class 和.java。 The comments to the original post have the full rundown.对原始帖子的评论有完整的纲要。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM