From: Robert P. J. D. <rp...@mi...> - 2003-03-06 12:13:38
|
(something i posted to the local LUG here, any comments on it? yes, i know you've seen something like this before, but i just want to make darned sure i understand it before i start working with a number of java-based XML programs.) ---------- Forwarded message ---------- Date: Thu, 6 Mar 2003 06:58:01 -0500 (EST) From: Robert P. J. Day <rp...@mi...> To: KWLUG discussion list <kwl...@kw...> Subject: just wanting to be absolutely sure about java under linux never having spent a *lot* of time programming in java under linux, i wanted to clarify everything involving java installation and configuration. as an example, i'll discuss setting up sun's latest j2sdk under red hat 8.0. first, downloading (from java.sun.com) sun's jdk and installing it creates a hierarchy under /usr/java/j2sdk1.4.1, with some of the more important directories: /usr/java/j2sdk1.4.1/ bin/ # (java, javac, etc) jre/lib/ # bootstrap classes ext/ # extension classes endorsed/ # endorsed classes there's more, but this is all i care about for now. (is the terminology above correct with respect to directory contents?) so, first, one obviously adds /usr/java/k2sdk1.4.1 to PATH. next queestion, which is technically the java "home" directory? that is, that one would assign to the variable JAVA_HOME that i've seen in use? i've seen conflicting answers, but it seems that /usr/java/j2sdk1.4.1/jre would be considered the home directory, no? the classpath --- --------- as i read it, the java programs *automatically* will look for classes in the bootstrap classes and the extension classes to start, before the CLASSPATH even comes into play, correct? as i read it, the interpreter search order is: 1) bootstrap classes 2) extension classes 3) user-defined classes, defined in a number of ways again, as i read it, if the CLASSPATH variable is not set, a default of "." is used so that, if you're compiling isolated programs in the current directory, you don't need to do *anything* with CLASSPATH, right? if, however, you want to use CLASSPATH, you would have to *explicitly* add "." for the current directory as one of the entries. is that correct? (that is, once CLASSPATH is defined. "." is no longer automatically on the class search path -- you have to supply that yourself.) also, the CLASSPATH entries can refer to one of three things: 1) the full names of .jar files you want to use 2) the full names of .zip files 3) *directories* which contain individual .class files the extension directory --- --------- --------- more than one person suggested to me that, rather than keep CLASSPATH up to date, you can just toss entire .jar or .zip files into the java extension directory, /usr/java/k2sdk1.4.1/jre/lib/ext (if you have the privilege), where they will be found automatically. apart from this being potentially messy, is there anything technically wrong with this approach? that is, does it have the same effect as working with CLASSPATH? or is there some subtle difference that i should know about? the endorsed classes --- -------- ------- finally, at http://java.sun.com/j2se/1.4/docs/guide/standards, you can read about the endorsed standards override mechanism, which allows you to override only *specific* standards, by adding .jar files to the endorsed directory. (i note that this says that these should be specifically .jar files, not .zip files. anyone know whether .zip files are also supported? not that it's a big deal.) that section also emphasizes which directory is considered to be the official java *home* directory, in case i needed any supporting evidence. so ... have i missed anything? is this a reasonably comprehensive description about how the java environment works in linux? rday |