title: Can't compile and execute java program
body: <p>I have the following simplified file structure: </p>
  
  <p><code>C:/red/green/black/yellow/white/pink</code>. I am now in cmd in folder 'black'.</p>
  
  <p>The <code>Hello.java</code>file has <code>package yellow.white.pink</code> in it. In folder 'pink' there is a <code>Hello.java</code> source file. </p>
  
  <p>First I try to compile the file:</p>
  
  <p><code>javac -classpath . -encoding ISO-8859-1 yellow.white.pink.Hello.java</code></p>
  
  <p><code>javac -cp . -encoding ISO-8859-1 yellow.white.pink.Hello.java</code></p>
  
  <p>These two give me an error: </p>
  
  <p><code>File not found yellow.white.pink.Hello.java</code>.</p>
  
  <p>Then I try</p>
  
  <p><code>javac -encoding ISO-8859-1 C:/red/green/black/yellow/white/pink/Hello.java</code></p>
  
  <p>It compiles just fine.</p>
  
  <p>To run it I do</p>
  
  <p><code>java -classpath . yellow.white.pink.Hello</code>
  And it runs just fine.
  But in this case</p>
  
  <p><code>java C:/red/green/black/yellow/white/pink/Hello.class</code> </p>
  
  <p>doesn't work - gives <code>Could not find or load main class</code> error. </p>
  
  <p>Why is that? Why can't I compile .java file when being in the root folder and giving a full package name and it works only with the whole path to the source, while the reverse is true for executing the program?</p>