Search code examples
javaclasspackagejavac

javac doesn't see class in package


my folder with all classes my program needs looks like this

first image

second image

The program successfully runs in Intellij idea Embedded Local Terminal but it isn't running in command prompt(cmd).

I run my program in cmd like this

C:\Users\misha\IdeaProjects\Elib\src>javac -cp . myTask\Main.java

But it just creates .class files.

my directory after running my program in console


Solution

  • The command javac compiles the file(s) you specify. After (successful) compilation, you are able to run the compiled files. Simply after compiling run java command on your public class that contains the main method.