File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes K&B  pg 805 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "K&B  pg 805 " Watch "K&B  pg 805 " New topic

K&B pg 805

Sahil Kapoor
Ranch Hand

Joined: Sep 12, 2009
Posts: 316
It is possible to create environment variables that provide an alias for long classpaths, The classpath for some of the jar files in J2SE can be quite long
ans o it is common for such an alias to be used when defining a classpath.If you see something like JAVA_HOME or $JAVA_HOME in examquestion it just means
"That part of the absolute classpath up to the directories we are specifying explicitly." You can assume that the JAVA_HOME literal means this, and is pre-pended to the partial classpath you use.

Problem 1: Dint understand English sentence and the meaning.

Problem 2 : I want to issue following command from anywhere in my Computer using windows

java -jar jar1.jar , where jar1 is an executable jar. Suppose it is in C:\

I used c:\jar1.jar; in class path

but when i issue the above command , it says cannot find jar1.jar ???

Thanks !!!

SCJP 6.0 96%

(Connecting the Dots ....)
Rajeev Rnair
Ranch Hand

Joined: Mar 22, 2010
Posts: 308

You can set environment variables (like JAVA_HOME) and access by $JAVA_HOME
For example: if you have JAVA_HOME=\usr\bin\java as env variable, you can say

It means $JAVA_HOME will be replaced with "\usr\bin\java" so that you don't have to write extremely long class paths.

#2 Have you tried adding -classpath? eg: java -classpath xxx -jar jar1.jar

SCJP6, SCWCD5, OCP-JBCD5, OCE-JWSD6 OCE-JPAD6 , OCM-JEA5 1,OCM-JEA5 2,3 - Brainbench certifications: J2EE, Java2, Java2-NonGUI, JSP, SQL2000 Admin, SQL2000 Programming , Brainbench certified Java Programmer, Computer Programmer, Web Developer, Database Administrator
I agree. Here's the link:
subject: K&B pg 805
It's not a secret anymore!