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

huangapple go评论144阅读模式
英文:

Java compilation through command prompt issue

问题

Java编译通过命令提示符问题我尝试使用javac命令将我的类文件“checker.class”编译成“checker.java”,计划用java命令运行它,但是javac要么给我“文件未找到”的问题,要么给我“无效的标志”(当我试图将checker放在引号中时)。
我还想更好地理解问题本身,而不仅仅是知道解决方案。谢谢。

我的尝试:

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

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

带有错误消息的结果:

  1. 错误:未找到文件:Checker.java
    用法:javac <选项> <源文件>
    使用--help获取可能选项的列表

  2. 错误:无效的标志:Checker.class
    用法:javac <选项> <源文件>
    使用--help获取可能选项的列表

计划执行:

C:\Users\jaede\Desktop\everything>java checker.java

*附注:我可能没有环境变量问题,因为我可以用java命令运行另一个.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:

  1. error: file not found: Checker.java
    Usage: javac <options> <source files>
    use --help for a list of possible options

  2. 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 Java编译通过命令提示符问题

答案1

得分: 0

我混淆了 .class 和 .java。原帖的评论中有详细的说明。

英文:

I got .class and .java mixed up. The comments to the original post have the full rundown.

huangapple
  • 本文由 发表于 2020年4月5日 05:06:41
  • 转载请务必保留本文链接:https://go.coder-hub.com/61034787.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定