Wednesday, March 12, 2014

JAVA DIRECTORY STRUCTURE

In the last tutorial i had written about how to prepare our machine to write java code. Now i am going to tell something about the directory structure of installed Java.

Most of beginner install JDK in program files directory , but i prefer to install JDK by making a separate folder inside a local drive.

After installing JDK in local hard drive we get following directory structure.
directory structure of installed JDK



  • On top of these sub directory we will have the root folder name with the version of JDK being installed like <jdk1.7.0_45> (its for jdk or java version 7 and update 45). This root directory also considered as Java Home directory in some context.
  • In the root directory of JDK we can find an archive file name with SRC , to know more about java we can extract that file and there we can find all .java file with description and we can further study that in application like wordpad or notepad++ or any other text editor.
  • Among all sub-directories, we can find include directory which contains header files(.h file) written to interact with the native language like c 
  • Besides include folder we can find bin folder, inside bin folder we can find all executable files and important of those to know are javac, java,jar,javaw,javaws. At initial level we can focus only on javac which is called as java compiler and java which is an interpreter.This directory should contain by the PATH environment variables. 
  • Among sub-directories we can find lib folder which contains different jar file,lib file and sys file and these files are used by executable files present in bin folder, in this there is tools.jar which contains non-core classes for support of the tools and utilities in jdk and there is dt.jar (designtime archieve) which tells IDE's how to display java componenets and how to let developer customize them for application..
  • Among all there is an important directory called as JRE. The jre directory contains the Java Runtime Environment facilities that are used when you execute a Java program. The classes in the Java libraries are stored in the jre\lib directory packed in the archive, rt.jar.The JRE takes care of retrieving what it needs from the archive when java program executes.
  • Inside jdk<version>\jre\bin there are Executable files and DLLs for the tools and Java platform. The executable files available in \jdk1.6.0\jre\bin are identical to the file available in \jdk1.6.0\bin. 
  • Inside \jdk<version>\jre\bin\client we can find the DLLs files which are used by Java HotSpot Client Virtual Machine. 
  • Inside \jdk<version>\jre\bin\server we can find the DLLs files which are used by Java HotSpot Server Virtual Machines. 
  • Inside \jdk<version>\jre\lib we can find the Code libraries, property settings, and resource files which are used by the Java runtime environment.
    For example:-
      1. rt.jar:-The bootstrap classes (these are the Runtime classes that comprise the Java platform's core API).
      2. charsets.jar:- These are Character conversion classes.
  • Inside \jdk<version>\jre\lib\ext we can find extensions of default installation directory for the Java platform.
    for example:- localedata.jar:-locale data for java. text and java.util. 
  • Inside \jdk<version>\jre\lib\security we can find the files which are used for security management. These includes the security policy (java.policy) and security properties (java. security) files.
  • Besides these all important sub-directories, some installation can have directory containing demo code as example and JNLP samples, which means JNLP, Java Network Launching Protocol that is used for executing applications or applets from a network server without the need for a
    browser or the need to download and install the code. 
Every body working with java or learning java must know these directory structure as it is good to know the result of work we are going to perform.As we were installing JDK so we should know after installing JDK what we will getting as end result.

-KEEP LEARNING,HAPPY CODING

No comments:

Post a Comment