2

I set the environment variable to setup JAVA_HOME.

Problem is, java is installed in c:\program files\blah\blah\

(notice the whitespace in the folder path).

so this works:

"%JAVA_HOME%\bin\java" -version

but w/o the quotes it doesn't.

I need to move the java folder to a directory like: c:\java\

Would moving it break anything?

I just un-installed and re-installed, and the darn thing didn't even ask me where I want to install it!

3 Answers 3

6

There's a registry key below HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment which is looked up by %windir%\system32\java.exe and others, like probably your browser. Just have a look with regedit - the keys and values should be obvious, or have a look at Deploying the JRE on Windows for JDK 1.6.

1

There are registry entries to worry about. But if you care only about the installation, and not about the browser plugin, then you can move it without caring about them.

In the latest versions of the JDK, there are copies of the java and javac executables inside the Windows\system32 directory - you might need to remove them and explicitly modify your global Windows path variable to have the JDK\bin directory.

0

It's easy to move any application if you keep in mind where all the pointers to Java need to change.

The main place is in the registry. If you are moderately knowledgeable (or brave) you can search for all references to an application in regedit with the find/next find commands. Do not change anything you are not sure of. I restrict myself to address changes from the current old entry to the new location.

I'd make any path changes first in the environment variables as the Advanced System Settings-->Environment Variables-->path-->edit gives you an alphabetic ease to scan list on entries. This is also where you would change things like JAVA_HOME, etc., environment variables. If you don't understand what these are you probably shouldn't be doing this.

Once the environment variables are changed, the registry has been updated accordingly. Now search for references to the old address in the registry and update them.

I then copy the whole application directory to the new location en block and then try to run. If it runs ok, everything you've done is appropriate so far.

Then delete the contents of the old directory (remember, you can still recover it from the recycle bin)

Now try to run it again. If all goes well you're golden and other than any shortcuts you may still have to correct, you're done. If it doesn't run now, you missed an entry in the registry (very unlikely by this point). You should be able to figure out what missing.

Another option is Application Mover from Fundic Software. It's free and open source. https://www.funduc.com/app_mover.htm . I've used it without issues so far but it doesn't change environment variables that I know of. You may have to tweak some environment of short cuts still.

Hope this helps

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .