Question

(I already examined the answers here and here, but that doesn't answers my question)

I copied Java's folders (JRE & JDK) to a local folder and I manage to run .jar application by this command:

SomeFolder\Java\jre6\bin\javaw.exe -jar SomeApp.jar

But how can I run .exe application (e.g. eclipse.exe) by a similar way in two cases:

  1. The application required only JRE
  2. The application required also JDK

p.s. unfortunately "portableapps.com" solution is not acceptable.

Was it helpful?

Solution

The problem with .exe files is that they typically search the Java runtime on their own and there is no generic way to tell all of them where it is located.

In case of eclipse you can though e.g. by editing the eclipse.ini file.

Add

-vm
/usr/lib/jvm/java-7-oracle/bin

to the beginning of the file (with your path) and it should now start using the runtime you have specified.

A generic solution would be to figure out how the exe file runs the java code and then run it manually via javaw.exe -jar - that might not be possible if the exe file has the java code included and extracts it on demand. There are on the other hand versions as plain jar (often the version for Linux) that don't need all the exe workarounds.

OTHER TIPS

Long story short...

1) Copy an installed version of the JDK (from another computer) you want to run to the destination computer.

2) Create a batch file to create or modify your environment variables, such as CLASSPATH, JAVA_HOME, and PATH.

@rem CONTENT OF BATCH FILE
@echo off
@cls
SET JAVA_HOME= <-- your JDK location
SET CLASSPATH=.;%JAVA_HOME%
SET PATH=%PATH%;%JAVA_HOME%\bin

3) Run this batch file before you launch Eclipse, or any executable that depends on the Java location. (Don't close the Command window or these transient values will vanish.)

4) You can close the Command window when you no longer need it.

This has worked for me since most Java dependent programs look for the JAVA_HOME variable in your computer's environment the path to Java binaries.

Have fun!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top