title: Batch file to setup jdk from memory stick
body: <p>I'm doing a year in computer science at my university and it turns out there are very few computers that have the jdk installed on them. I can run eclipse portable from my memory stick, so compiling java should be possible.</p>
  
  <p>What I was wanting was a batch file that set up the environment variables on the system so that I am able to run the portable version of the jdk from my memory stick. I don't appear to be able to alter the system variables but can change the user ones.</p>
  
  <p>So far I have the below code as a batch file, though it still leaves me with a javac not recognize message when run. As a final note I should point out I don't have a great deal of experience with batch files.</p>
  
  <pre><code>echo %path% &gt; stored_path.txt
  setx PATH "%cd%PortableApps\CommonFiles\OpenJDK\bin;%PATH%"
  setx JAVA_HOME "%cd%PortableApps\CommonFiles\OpenJDK"
  setx CLASSPATH "%cd%PortableApps\CommonFiles\OpenJDK\bin;%CLASSPATH%"
  </code></pre>
  
  <p>Thanks for any help you can give me.</p>
  
  <p>Update 04/10/13 - 16:54:</p>
  
  <p>Just to clarify Eclipse itself works fine and is fully usable. However I have a jdk saved on the memory stick that works as if I call javac from a console that is open to that directory it works fine. What I want to know is if there is a way for windows to recognise this command from any directory on the system by just changing the user environment variables.</p>
  
  <p>A thought that just occurred to me (I can't test it right now), is that would making a shortcut to the javac exe file in another folder work?</p>