title: java console error could not find or load main class
body: <p>I have a class with the main method. When i'm using the Windows command line to run the main method of the class, the compiling process with "javac" command works well (current location for the command line - directory with this class). File named "Card.class" gets created nearly to "Card.java" file. But command "java Card" returns error with the description "Could not find or load main class". In Intellij Idea this method within the class works completely well.</p>
  
  <p>What i've tried to do to solve the problem (some solves were taken from StackOverflow topics):</p>
  
  <p>1)Full reinstall of JDK and JRE.</p>
  
  <p>2)Rewrote all my environment variables:</p>
  
  <p>JAVA_HOME = C:\Program Files\Java\jdk1.8.0_144</p>
  
  <p>JDK_HOME = %JAVA_HOME%</p>
  
  <p>PATH = C:\Program Files\Java\jdk1.8.0_144\bin</p>
  
  <p>CLASSPATH = %JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\jre\lib\tools.jar</p>
  
  <p>3)I tried different variations for the "CLASSPATH" environment variable. Also, I manually wrote this: "java -classpath "$s" Card", where the value for "-classpath" parameter i copied from Intellij Idea command, that had been returned after running the program in the IDE.</p>
  
  <p>4)Tried some variations for class name in the command (from just "java Card"
   to "java package_name.Card" in the source project directory). All of these variations were recognized by the command line, returning the same error.</p>
  
  <p>I'm thinking that the problem with the "classpath" variable, but all solutions i found are suggesting different values for this variable, and any of them had worked. Last updated value of the variable is mentioned before.</p>
  
  <p>Here is my class (possible that the problem is here): </p>
  
  <pre><code>package cards;
  
  public class Card {
  
      //Constants, constructor, getters, setters, validation checking methods
  
      public static void main(String[] args) {
  
          // Just to see in the command line that the method was invoked
          System.out.println("WORK");
  
          // "assert" checks for constants values
  
      }
  }
  </code></pre>
  
  <p>Stacktrace for my error:</p>
  
  <p>myPathToTheProject\src\cards>java Card</p>
  
  <p>Error: Could not find or load main class Card</p>