Search code examples
javacompiler-errorsprompt

Java compilation through command prompt issue


My bad attempt that is the same as what I did with checkerI 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 use --help for a list of possible options

    1. error: invalid flag: Checker.class Usage: javac

    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 My prebuilt fibonacci number generator.


Solution

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