Featured

    Featured Posts

Install the software and set the path


Install the software and set the path :-

·         Download the software from internet based on your operating system.

·         The software is different from 32-bit operating and 64-bit operating system.

·         To download the software open the fallowing web site.

http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html

For 32-bit operating system please click on 
Windows x86:- 32- bit operating system
For 64-bit operating system please click on
Windows x64 :- 64-bit operating system

JDK Folder Hierarchy



How to Set Path and Classpath in Java

Java Classpath Setting

Path Variable

·         Path variable is set for providing path for all java tools like java, javac,javap, javah, jar, appletviewer which are use in java programming. These all tools are available in bin folders so we set path upto bin folders.

Classpath Variable

·        Classpath variable is set for providing path for predefined java classes which is used in our application. All classes are available in lib/rt.jar so we set classpath upto lib/rt.jar.

 

Why set path ?

·        The following programming error is general for all java programmers when they compile any java program.

·        'javac' is not recognized as an internal or external command, operable program or batch file.

·        When you get this type of error, then your operating system cannot find the java compiler (javac). To solve this error you need to set the PATH variable.

·        Javac is a tool which is available in bin folder so you must set the PATH upto bin folder. In a bin folder all tools are available like javap, javah, jar, javac, java, appletviewer etc. These all tools are used for different-different purpose.



set the path and classpath

·         Go on my computer icon and right click, after that click on properties option.



·         Now click on advance setting

·         Click on advance


·         Click on Advance variables



·         Click on new button which is below the first box.


·         Now one dialog box is appear, now ignore this but do not close.



·         Now open my computer open c:/ > Programs Files > java > java1.6.0 > bin copy this path




·         Now come back on previous open dialogbox and write variable name 'path' and for variable value paste all copied path up to bin folder. Put.;at the end. It (.) select all the tools from bin folder.


·         Now open my computer open c:/ > Programs Files > java > java1.6.0 >jre > lib > rt.jar copy this path

·         Note:rt.jar is available in lib folder this jar files contains all classes of jdk.


·         Now again come back on Environment variable dialogbox and click on new. Now one box is open and write path variable as 'classpath' and for variable value paste all copied path up to rt.jar. Put dot (.)At the end. It (.) select all the classes from lib folder.






·         Note: Finally after set classpath Restart your system, or you can re-open command prompt.


·         Difference between path and classpath in Java

Path

·         Path variable is set for provide path for all java tools like java, javac, javap, javah, jar, appletviewer which are use at the time of java programming like for run java any program we use java tool and for compile java code use javac tool. These all tools are available in bin folder so we set path upto bin folder.

classpath

·         classpath variable is set for provide path of all java classes which is used in our application. All classes are available in lib/rt.jar so we set classpath upto lib/rt.jar.

Difference between path and classPath

 

path

classpath

path variable is set for provide path for all java tools like java, javac, javap, javah, jar, appletviewer

classpath variable is set for provide path of all java classes which is used in our application.

 









  

www.CodeNirvana.in

Powered by Blogger.

About

Site Links

Popular Posts

Translate

Total Pageviews