unset JAVA_HOME via command prompt

Posted on 2014-02-21
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"  

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

Question by:jazzIIIlove
  • 2
  • 2
  • 2
  • +1
LVL 86

Accepted Solution

CEHJ earned 200 total points
ID: 39877076

Open in new window

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


Open in new window


Assisted Solution

jairajnaidu earned 100 total points
ID: 39877142
LVL 12

Author Comment

ID: 39877180
unset fails
NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

LVL 86

Assisted Solution

CEHJ earned 200 total points
ID: 39877543
Thought it probably would ;)
LVL 28

Assisted Solution

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

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%
LVL 12

Author Comment

ID: 39879118

Any reference for your source?

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

LVL 28

Assisted Solution

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 /?

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
netstat -ano | find "8000" and taskkill /f /pid 2984 3 37
servlet  URL Rewriting 1 27
varialbe initialization 11 30
who removed AD Domain ID 9 26
Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
If you get continual lockouts after changing your Active Directory password, there are several possible reasons.  Two of the most common are using other devices to access your email and stored passwords in the credential manager of windows.
This Micro Tutorial will teach you the basics of configuring your computer to improve its speed. It will also teach you how to disable programs that are running in the background simultaneously. This will be demonstrated using Windows 7 operating…
This Micro Tutorial will give you a basic overview of Windows DVD Burner through its features and interface. This will be demonstrated using Windows 7 operating system.

895 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now