Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

My JAVA_HOME on my dev machine - which is Windows 7 Pro 64 Bit - points to a 64-bit Java, and that's fine in general. However, I just installed a program - to wit, the FlashDeveloper IDE - for which this setting is not fine: a 32-bit Java is required instead, and the JAVA_HOME setting prevents the 32-bit Java from being picked up.

So I'd like to unset JAVA_HOME just before launching the Flash IDE.

One way to achieve this would be via a batch script.

But isn't there a better way? I searched the various tabs of the Windows Shortcut properties window for such an option but there doesn't seem to be any. (I did discover, however, a checkbox for running the program through the shortcut as Administrator.) Any suggestions?

Update: Solution that worked for me

:: type "C:\Program Files (x86)\FlashDevelop\FlashDevelop.bat"
@ECHO OFF
SETLOCAL
REM Prevent wrong 64-bit JVM from being picked up:
SET JAVA_HOME=
CALL "%~dpn0.exe"

That will open up a command prompt which I can then just close. You can make the shortcut have the icon of the executable you're calling from the command prompt by instructing the shell via the shortcut properties to go looking for an icon inside the actual executable.

I couldn't get the solutions involving START to work, which opens up a new cmd.exe window on my machine when passed the following (no idea why):

start "C:\Program Files (x86)\FlashDevelop\FlashDevelop.exe"

Must say that my cmd.exe is tuned - that might have an influence here and there.

Update regarding the start issue: As can be learnt following the link in the comments, the start command uses the first arguments in quotes as the title of the windows to be created … So when you pass a path in quotes, it'll be misinterpreted as the title of the new window. Workaround is to provide an explicit title as first argument, which may also be empty (start "" "some path\with spaces").

share|improve this question
1  
See stackoverflow.com/questions/72671/… for the start issue –  fglez Dec 20 '13 at 23:18

3 Answers 3

up vote 3 down vote accepted

Sorry for reviving an old thread, but I figured this could probably help people searching for a solution to this problem:

You can override you JAVA_HOME path directly in your FlexSDK. To do this, navigate to your SDK's 'bin/' folder (should be in 'C:\Program Files (x86)\FlashDevelop\Tools\flexsdk\' if you let the FD installer set it up for you, otherwise you probably know where it is) and open 'jvm.config'.

share|improve this answer

I think don't think you can do it in the shortcut itself, so the shortcut needs to point to something that sets the variable, and then lauches your program. Of course, there are infinite ways of doing that, but the command script is probably simplest.

If you use start command.exe in you bat file, you will get a command window flashing by, but it will not stick around.

Update: It actually works to put this as a shortcut target.

C:\Windows\System32\cmd.exe /c "set HOME=c:\ && start C:\Windows\System32\notepad.exe"

Update 2: That did not work with a space in the command path. But this does!

C:\Windows\System32\cmd.exe /c "set HOME=c:\ && path %path%;C:\Program Files (x86)\VideoLAN\VLC && start vlc.exe"
share|improve this answer

Note that set is only temporary, so you can just put the following in a batch:

set JAVA_HOME=
program.exe
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.