title: Unable to rectify the cause during installation of java and setting java path in batch file
body: <p>I need to install java and set the Java path. 
  I'm able to install java and can  see two folders in C:\Program Files (x86)\Java i.e Jre and Jdk .</p>
  
  <p>But when i'm trying to set the JAVA_PATH in my code but i can't its path on command propmt echo command i.e   @echo JAVA_HOME = %JAVA_HOME%. Though i have started scripting today itself so unable to rectify where i'm missing out ?</p>
  
  <p>here is the code that i tried  :-</p>
  
  <pre><code>     @echo off
  
      for /f %%j in ("java.exe") do (
       set JAVA_HOME=%%~dp$PATH:j
       **@echo JAVA_HOME = %JAVA_HOME%**
      ECHO "ok1"
      PAUSE
      )
     if %JAVA_HOME%.==. (
     @echo java.exe not found 
      PAUSE
      CD C:\Users\Pathfinder\Desktop
     ECHO "Time In"
  
      jdk-6u43-windows-i586.exe /s "/v\"/qn ADDLOCAL=ALL  REBOOT=Suppress JAVAUPDATE=0  
       CUSTOM=1\""
  
       timeout /t 10 /nobreak
       ECHO "Time Out"
       set path="C:\Program Files (x86)\Java\jre6\bin";%path%
  
       @echo PATH= %path%
       set JAVA_HOME="C:\Program Files (x86)\Java\jdk1.6.0_43\bin";%JAVA_HOME%
  
       **@echo JAVA_HOME = %JAVA_HOME%**
  
       PAUSE
       ) else (
       @echo JAVA_HOME = %JAVA_HOME%
  
     PAUSE
      )
  </code></pre>
  
  <p>After one time execution of my batch file means process completed after double clicking the batch file when i'm again double clicking the batch file then its going to 'IF' condition again i.e " java.exe not found "  .</p>