Using Java from Command-line

Overview

Java after being installed using JDK is self-contained programming environment with which you can build a whole application without any additional tools (except some decent text editor). Some tutorials present first Java steps with help of command-line tools from JDK, below I present some basic information related to this topic.

What is version of your Java JRE (runtime)?

Run the following command-line command:

java.exe -version

You should see something like:

java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b18)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)

where "1.8.0_25" is your runtime version number.

If you have problems with execution of this command it means JRE is not installed or is not available on your command search path (PATH on Windows/DOS).

What is version of your Java JDK (compiler, libraries)?

Run the following command-line command:

javac.exe -version

You should see something like:

javac 1.7.0_13

where "1.7.0_13" is your compiler version number.

If you have problems with execution of this command it means JDK is not installed or is not available on your command search path (PATH on Windows/DOS). This version should be the same as the JRE you are using (see javac above).

See also

Share

follow