JavaBeat Certifications Certifications Kits Articles Interview Questions OCAJP 7 OCPJP 5 OCPJP 6 OCEJWCD 6 SCBCD 5.0 SCEA SCJA

SCJP: Classpath and Jar

Topic :
Feedback Request New QnA Print Email

Java certification exams like SCJP test your knowledge about java classpath. Check here for an excellent resource on the topic .

System classpath

We can specify classpath in the command line or make use of a `system' class path. The IDEs have their own way of maintaining class paths. System class paths will be used by both the Java compiler and the JVM in the absence of specific instructions.

Set Linux System Classpath:
CLASSPATH=/myclasses/myclasses.jar;export CLASSPATH

Windows:
set CLASSPATH=c:\myclasses\myclasses.jar

For permanent result, in Linux, put the commands in the file .bashrc in your home directory. On Windows 2000/NT, set it from `Control Panel', System, Environment Variables.

You can also specify .jar files full of your required classes in your classpath.

CLASSPATH=/usr/j2ee/j2ee.jar:.;export CLASSPATH

where the `.' indicates `current directory'.

From command line, if you want to add more paths to the classpath use:

Linux:javac -classpath $CLASSPATH:dir1:dir2 ...

Windows:javac -classpath %CLASSPATH%;dir1:dir2 ...

if you have spaces in your path use double quote to concatenate words.

Also check this resource

Topic :
Feedback Request New QnA Print Email

All api java java 6.0 java 7.0 jdbc jsp servlet ejb jndi jms ejb 3.0 j2ee jee 5.0 jee 6.0 jsf struts spring Hibernate ajax JBoss Seam netbeans eclipse ant xml maven dojo junit javafx j2me log4j ESB JBoss Apache Quartz scjp mysql oracle gwt openjpa jmx yui google-guice android JBoss scwcd 5.0 scjp 1.5 scjp 1.6 scja scbcd 5.0

javabeat | advertise | about us | contact | useful resources
Copyright (2004 - 2013), JavaBeat