Ridhima Ridhima -4 years ago 94
Java Question

How to run a Java class file with a jdk binary?

I have downloaded jdk binaries (

jdk.tar.gz
) of different JDK versions, say
8u92, 8u121
and
8u131
in a directory.

I want to run a Java program in each of these java versions and know the output. Is there a way to do this?

Something like extract
jdk.tar.gz
, put the class file somewhere in the jdk and execute?

Thanks ahead.

Answer Source

The most easy way is to extract the three JDK versions, put the .class files in each folder, run the terminal/cmd from each folder and use java.exe MainClass This way you are not using the java executable in your classpath but the java executable in the folder you are currently in

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download