Setting Classpath for Java
Java is freely available on Oracle's Website. Download the latest version of JDK (Java Development Kit) on your machine. Do check whether your machine is 32 bit or 64 bit and download that particular Java version. Install JDK on your machine. Once you have installed Java on your machine you would need to set an environment variable to point to correct installation directory.
An Environment variable is a dynamic "object" on a computer that stores a value(like a key-value pair), which can be referenced by one or more software programs in Windows. Like for Java, we will set an environment variable with name "java" and its value will be the path of the /bin directory present in the Java directory. So whenever a program will require Java environment, it will look for the Java environment variable which will give it the path to the execution directory.
Setting up a path for Windows ( 2000/XP/Vista/Window 7,8 )
Assuming that you have installed Java in C:\ Program files/ Java / JDK directory
Step 1: Right click on my computer and select properties.
Step 2: Go to the Advanced System Settings tab
Step 3: Click on Environment Variables button.
Step 4: Now alter the path variable so that it also contains the path to the JDK installed directory.
For e.g:- Change C:\windows/ system 32. to C:\windows/system 32; C:\program files / Java/ JDK.
Setting up a path for window 95/98/ME
Assuming that you have installed Java in C:\program files\ java\ JDK directory, do the following:
Step 1: Edit the C:\autoexec.bat file and add the following line at the end.
SET PATH =% PATH% C:\ PROGRAM FILE/JAVA/JDK/bin
Setting up a path for Linux, Unix, Solaris, Free BSD
Assuming that you have installed Java in C:\program files\ java\ JDK directory, do the following:
Step 1: Environment variable path should be set to point where java binaries have been installed. Refer to your shell if you have trouble doing this.
For Example: If you use bash as your shell, then you would add the following line to the end
bash mc: export PATH=/ Path/to/java
Diff between JDK, JRE, and JVM
What is JVM?
JVM (Java Virtual Machine) is an abstract machine that enables your computer to run a Java program.
When you run the Java program, Java compiler first compiles your Java code to bytecode. Then, the JVM translates bytecode into native machine code (set of instructions that a computer's CPU executes directly).
Java is a platform-independent language. It's because when you write Java code, it's ultimately written for JVM but not your physical machine (computer). Since JVM executes the Java bytecode which is platform independent, Java is platform-independent.
What is JRE?
JRE (Java Runtime Environment) is a software package that provides Java class libraries, along with Java Virtual Machine (JVM), and other components to run applications written in Java programming. JRE is the superset of JVM.
If you need to run Java programs, but not develop them, JRE is what you need. You can download JRE from Java SE Runtime Environment 8 Downloads page.
What is JDK?
JDK (Java Development Kit) is a software development kit to develop applications in Java. When you download JDK, JRE is also downloaded, and don't need to download it separately. In addition to JRE, JDK also contains the number of development tools (compilers, JavaDoc, Java Debugger etc).
If you want to develop Java applications, download JDK.
Here's the relationship between JVM, JRE, and JDK.







Comments
Post a Comment