Re: [CODE4LIB] arg! classpaths! [resolved]
On Jan 26, 2008, at 9:40 AM, Godmar Back wrote: Please see http://faq.javaranch.com/java/HowToSetTheClasspath On Jan 26, 2008, at 9:49 AM, Galen Charlton wrote: When dealing with JAR files, each entry in CLASSPATH should be the full path to the JAR file, e.g., export CLASSPATH=/home/eric/lucene/lucene-core-2.3.0.jar:/home/eric/ lucence/lucene-demos-2.3.0.jar You use a plain directory as a CLASSPATH component only if you intend to use .class files that has not been packaged up in a JAR. Thank you for the prompt replies. Yes, my CLASSPATH needed to be more specific; it needed to specify the .jar files explicitly. I can now run the demo. (Arg! Classpaths!) -- ELM
Re: [CODE4LIB] arg! classpaths! [resolved]
To add a bit of experience gained from 13 years of Java programming: I strongly recommend against setting CLASSPATH in the shell. Instead, use either the -cp switch to java, as in java -cp lucene-core...jar:lucene-demo-.jar or use the env command in Unix, as in env CLASSPATH=/home/eric/lucene/lucene-core-2.3.0.jar:/home/eric/lucence/lucene-demos-2.3.0.jar java These options achieve the same effect, but unlike export, they will not change the CLASSPATH environment variable for the remainder of your shell session. For instance, this command: export CLASSPATH=/home/eric/lucene/lucene-core-2.3.0.jar:/home/eric/lucence/lucene-demos-2.3.0.jar will make it impossible to execute javac or java for .class files in the current directory (because you've excluded . from the classpath, which by default is included.) Note, however, that this rule does not apply to shell scripts: inside shell scripts, it's okay to export CLASSPATH because such settings will be valid only for the shell executing the script; in Unix, changes to environment variable will not reflect back to the shell from the shell script was started. - Godmar You use a plain directory as a CLASSPATH component only if you intend to use .class files that has not been packaged up in a JAR. Thank you for the prompt replies. Yes, my CLASSPATH needed to be more specific; it needed to specify the .jar files explicitly. I can now run the demo. (Arg! Classpaths!) -- ELM
Re: [CODE4LIB] arg! classpaths! [resolved]
On Jan 26, 2008 10:12 AM, Godmar Back [EMAIL PROTECTED] wrote: Note, however, that this rule does not apply to shell scripts: inside shell scripts, it's okay to export CLASSPATH because such settings will be valid only for the shell executing the script; in Unix, changes to environment variable will not reflect back to the shell from the shell script was started. Oops, should read: ... changes to environment variables will not reflect back to the shell from *which* the shell script was started. I should also mention that if you place an export CLASSPATH command in your ~/.bash_profile or ~/.bashrc, you've committed the same mistake because the setting then will be valid for your initial shell session (or every new session, or both, depending on the content of your ~/.bash_profile.) So ignore any instructions that propose you do that. - Godmar