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
Wyndham

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
Neutron16

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
Wyndham

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
UsernameIssues

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.

-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
Wyndham

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
UsernameIssues

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
Thread Forum
Java Runtime Env not available to run Movie Manager Pro
Hey everyone. This is the error I get when I try to run MovieManger "A Java Runtime Environment (JRE) or Java Development Kit (JDK) must be available in order to run MovieManager. No Java Virtual Machine was found after searching the following locations. C:\Program Files...
Software
Java Runtime Environment 7.13 Early Release
Java CPU Feb 2013 Java SE Downloads Oracle rushes out another Java update, fixing 50 vulnerabilities A Guy
Security News
Java Runtime Enivronment
Is there good reasons to run, or not to run "Java Runtime Environment". Sorry, I'm running the latest version of FireFox.
Browsers & Mail
Java Runtime 6.0
Hi there, First what a fantastic site. I have already gained so much from reading other peoples posts. Unfortuately I have not found an answer to my problem. I try to install PS3server and it asks for java runtime to be installed. It then tries to install Java and I get the following error; ...
Software
Java SE Runtime Environment (JRE 6 Update 17)
Java SE JRE 6 Update 17 is now available.Release Notes.. For 32 bit, select Windows For 64 bit, select Windowsx64
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 14:17.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App