Use jenv or /usr/libexec/java_home -v 1.6 :

"C:\Program Files\Java\jdk1.6.0_45\bin\java" -jar yourLegacyApp.jar

Find a that doesn't require a full system installation.

export JAVA_HOME=/usr/local/java6 # or /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home on macOS export PATH=$JAVA_HOME/bin:$PATH java -version

:

chmod +x jdk-6u45-linux-x64.bin ./jdk-6u45-linux-x64.bin sudo mv jdk1.6.0_45 /usr/local/java6

Before Java 6, developers often had to rely on complex third-party tools to see what was happening inside their applications. Java 1.6.0 changed this by including powerful, built-in diagnostic tools that work right out of the box.