title: how to run a java file from a parent directory?
body: <p>I am able to compile a java file that is inside a directory by using javac &lt;directory_name&gt;/Solution.java.
  but I am not able to run the java program in the same manner ie. java /Solution.</p>
  <p>as it gives me this error :</p>
  <blockquote>
  <p>Error: Could not find or load main class code.Solution Caused by:
  java.lang.NoClassDefFoundError: Solution (wrong name: code/Solution)</p>
  </blockquote>
  <p><em>Here code is my directory name.</em></p>
  <p>I could cd into the directory and do it. which actually works but that is not the behavior that I desire.</p>
  <p>How to achieve this?</p>