Solved

unset JAVA_HOME via command prompt

Posted on 2014-02-21
7
3,169 Views
Last Modified: 2014-03-13
I accidentally set:

set JAVA_HOME=C:\"top level directory of your java install"  
set CATALINA_HOME=C:\"top level directory of your Tomcat install"  
set PATH=%PATH%;%JAVA_HOME%\bin;%CATALINA_HOME%\bin  

I want to revert this via command prompt. What should i do?

Regards.
0
Comment
Question by:jazzIIIlove
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 86

Accepted Solution

by:
CEHJ earned 200 total points
ID: 39877076
SET JAVA_HOME=''

Open in new window


or (maybe - can't quite remember if that works on Windows)

UNSET JAVA_HOME

Open in new window

0
 
LVL 1

Assisted Solution

by:jairajnaidu
jairajnaidu earned 100 total points
ID: 39877142
SET JAVA_HOME=''
0
 
LVL 12

Author Comment

by:jazzIIIlove
ID: 39877180
unset fails
0
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 
LVL 86

Assisted Solution

by:CEHJ
CEHJ earned 200 total points
ID: 39877543
Thought it probably would ;)
0
 
LVL 29

Assisted Solution

by:serialband
serialband earned 200 total points
ID: 39877996
Setting that in the command prompt only changes it temporarily in the one command prompt window.  If you need to set it for future command prompt windows, you'll need to set it for the system.

Right click on My Computer
Select Properties from the pull down menu
Click on Advanced system settings in the left sidebar
Click on the Advanced tab
Click on the Environment Variables... button

Look for your variables and you can either edit or delete them.


If you have to do this for several systems via scripts, use the reg command to edit these hives.  A reboot may be needed.

User Variables
HKEY_CURRENT_USER\Environment

System Variables
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment

Assuming they're only user environment variables.
reg query HKCU\Environment
reg delete HKCU\Environment /v JAVA_HOME
reg delete HKCU\Environment /v CATALINA_HOME

Don't just delete the path, without checking that you don't have other paths in there!!
reg query HKCU\Environment /v PATH
if it's just your paths, then delete.
reg delete HKCU\Environment /v PATH
If you have other paths that's needed by other installations, be sure to put them in place.
reg add HKCU\Environment /v PATH /t REG_EXPAND_SZ, data:%PATH%
0
 
LVL 12

Author Comment

by:jazzIIIlove
ID: 39879118
serialband:

Any reference for your source?

Is there a way to backup/restore env. variables?

Regards.
0
 
LVL 29

Assisted Solution

by:serialband
serialband earned 200 total points
ID: 39879331
What reference do you mean?  A link?  I did those from memory and with reg query.  It's been a little while, but I ran those reg commands frequently to configure new systems and set up environment variables.  I've also test setups within a single command prompt and I'm pretty certain they don't stay set on the system when you close them.


To find the reg commands.
reg /?
Most Windows/DOS commands accept /? to list the help, similar to the -h with linux commands.  There's also help COMMAND_NAME for DOS commands, which doesn't happen to work with the Windows reg command.


To export them to a *.reg file and import them back.
reg export /?
reg import /?
0

Featured Post

RoboForm Secure Password Management System

RoboForm Everywhere - Superb Browser Support
Windows / Apple / IOS / Android / Linux / Chrome OS
Use different complex passwords everywhere
Best Secure Password Management by far
Synchronize all of your devices instantly
Safe, Secure & Highly Recommended!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Background Information Recently I have fixed file server permission issues for one of my client. The client has 1800 users and one Windows Server 2008 R2 domain joined file server with 12 TB of data, 250+ shared folders and the folder structure i…
When you start your Windows 10 PC and got an "Operating system not found" error or just saw  "Auto repair for startup" or a blinking cursor with black screen. A loop for Auto repair will start but fix nothing.  You will be panic as there are no back…
The viewer will learn how to implement Singleton Design Pattern in Java.
This Micro Tutorial will give you basic overview of the control panel section on Windows 7. It will depth in Network and Internet, Hardware and Sound, etc. This will be demonstrated using Windows 7 operating system.
Suggested Courses

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question