Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

K&B pg 805

 
Sahil Kapoor
Ranch Hand
Posts: 316
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 !!!
 
Rajeev Rnair
Ranch Hand
Posts: 310
1
Java Linux Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic