here is an excerpt from: https://docs.oracle.com/cd/E19062-01/sun.mgmt.ctr36/819-4837/system-prep-2/index.html
Java Environment variables and paths
On Solaris systems, the Java_home and PATH environment variables must be set up before the Sun Management Center 3.6 Setup Wizard, the Setup Wizard, and the Java console work correctly. Similarly, to make the Sun Management Center Java console work correctly on Microsoft Windows, you must modify Microsoft windows%path% to include the path to the JDK software.
If environment variables and paths are not set correctly, the installation and setup of Sun Management Center 3.6 will fail.
Setting java_home and path on the Solaris platform
If you have installed JDK 1.3.1 or JDK 1.4 software in the default location, do the following:
Steps
-
Type su-root to log on as Superuser.
-
Set the Java_home to/usr/j2se.
Hint –
Add the appropriate statement to the. loginor.cshrc file.
-
Add/usr/j2se/bin to the system path.
-
Place the/usr/j2se/bin before the/usr/bin in path.
-
Place the/usr/bin before the/USR/UCB in path.
Set the path on Microsoft Windows 98
The following procedure assumes that the JDK 1.3.1 or JDK 1.4 software is installed to the default location C:\J2SDK version number, for example, C:\j2sdk1.4.
Steps
-
Edit the C:\autoexec.bat file.
-
Add the location of the Jdkbin directory to the path statement.
For example, the path statement in the Autoexec.bat file is Path=c:\windows;c:\windows\command, and the new path statement is Path=c:\windows;c:\windows\command;c:\ J2 version number \ bin where the version number is the version number of the JDK.
For example:
Path=c:\windows;c:\windows\command; C:\j2sdk1.4\bin
As shown in the example above, each directory in the path statement is separated by semicolons.
-
Save and close the file.
To set the path on Microsoft Windows 2000 or Microsoft Windows NTSteps
-
Select Start, Settings, Control Panel.
-
Double-click System.
-
In Microsoft Windows NT, select the environment tag. In Microsoft Windows 2000, select the advanced tag, and then select the environment variable.
The Environment Variables window is displayed.
-
In user variables and system variables, click Path.
-
Click Edit.
The Edit System Variables window is displayed.
Note –
The Edit System Variables window uses the environment variable%systemroot% to represent the Microsoft Windows root directory.
-
Add the location of the Jdkbin directory to the path statement.
For example, if the path statement displayed in the Edit System Variables window is%systemroot%\system32;%systemroot%, the new path statement should be%systemroot%\system32;%systemroot%;c:\ J2 version number \ bin where the version number is the version number of the JDK.
For example:
%systemroot%\system32;%systemroot%;c:\j2sdk1.4\bin
As shown in the example above, each directory in the path statement is separated by semicolons.
-
Click OK consecutively to close each window.
Set the path on Linux.Steps
-
Go to your home directory.
CD $HOME
-
Open a. bashrc file.
-
Add the following to the file: replace the JDK directory with the name of the Java installation directory.
Export PATH=/USR/JAVA/<JDK Directory>/bin: $PATH
-
Save the file and exit.
Use the source command to force Linux to reload the. bashrc file, which is generally read-only when you log on each time.
source. BASHRC
Note –
Note that if you are setting up path for all users, you must log on to the bash shell as Superuser, and then perform the above steps in the. profile file under the ETC directory, rather than in the. bashrc file in the home directory.
Configuration of my environment variables:
The configuration of environment variables under windows:
Java environment variable Configuration