Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: How to find java runtime in dos on Windows 7


10 Mar 2012   #1

Windows 7 RC
 
 
How to find java runtime in dos on Windows 7

I have been unsuccessful in finding the right DOS commands to achieve this and would appreciate some help.

This is an extract from my registry:

[HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment\1.6]
"JavaHome"="G:\\Program Files (x86)\\Java\\jre6"

Not sure why it is showing the double backslash...

I've tried various commands (in BATch files), such as the following, without success:

- - - -
@echo off
set KeyName=SOFTWARE\JavaSoft\Java Runtime Environment\1.6
REM set KeyName=HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment
set Cmd=reg query "%KeyName%" /s
for /f "tokens=2*" %%i in ('%Cmd% ^| find "JavaHome"') do set JAVA_HOME=%%j

set JAVA_HOME
pause
- - - -

Any help will be appreciated.

I know this can be set manually, but this is not what is needed.


My System SpecsSystem Spec
.

12 Mar 2012   #2

Windows 8.1 ; Windows 7 x86 (Dec2008-Jan2013)
 
 

You have missed one detail:
Code:
@echo off 
set KeyName=HKLM\SOFTWARE\JavaSoft\Java Runtime Environment\1.6 
REM set KeyName=HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment 
set Cmd=reg query "%KeyName%" /s 
for /f "tokens=2*" %%i in ('%Cmd% ^| find "JavaHome"') do set JAVA_HOME=%%j 
set JAVA_HOME 
pause
My System SpecsSystem Spec
13 Mar 2012   #3

Windows 7 RC
 
 

Thank you for responding. I should have mentioned that your suggestion was one of the variations I had tried - sorry.

Here is a screen print showing the result of two different tests.



Thanks again for trying to help
My System SpecsSystem Spec
.


13 Mar 2012   #4

W7 Pro SP1 64bit
 
 

Neutron16's change worked for me. Should you be using HKLM64? I only have a 32bit VM to test in right now.

How to find java runtime in dos on Windows 7-reg.jpg

Code:
cd\
set KeyName=HKLM\SOFTWARE\JavaSoft\Java Runtime Environment\1.6
set Cmd=reg query "%KeyName%" /s
for /f "tokens=2*" %%i in ('%Cmd% ^| find "JavaHome"') do set JAVA_HOME=%%j
set JAVA_HOME
pause


My System SpecsSystem Spec
14 Mar 2012   #5

Windows 7 RC
 
 

Excellent, thank you.

The successful search string is: HKEY_LOCAL_MACHINE\Software\Wow6432Node\JavaSoft\Java Runtime Environment\1.6
My System SpecsSystem Spec
14 Mar 2012   #6

W7 Pro SP1 64bit
 
 

Great :-)
My System SpecsSystem Spec
Reply

 How to find java runtime in dos on Windows 7




Thread Tools



Similar help and support threads for2: How to find java runtime in dos on Windows 7
Thread Forum
Solved Java Runtime Env not available to run Movie Manager Pro Software
Java Runtime Environment 7.05 Released Software
Java Runtime Environment 7.04 Released Software
Java Runtime Enivronment Browsers & Mail
Java Runtime 6.0 Software
Java SE Runtime Environment (JRE 6 Update 17) Software

Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 08:53 AM.
Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App
  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33