[CODE4LIB] arg! classpaths!

2008-01-26 Thread Eric Lease Morgan

(Arg! Classpaths!)

Please tell me why Java throws the NoClassDefFoundError error when I
think I have set up my classpath correctly:

$ pwd
/home/eric/lucene
$ ls -lh
total 720K
-rw-r--r-- 1 eric eric 650K 2008-01-26 08:30 lucene-core-2.3.0.jar
-rw-r--r-- 1 eric eric  52K 2008-01-26 08:30 lucene-demos-2.3.0.jar
$ export CLASSPATH=$PWD:.
$ echo $CLASSPATH
/home/eric/lucene:.
$ java org.apache.lucene.demo.IndexFiles
Exception in thread main java.lang.NoClassDefFoundError: org/apache/
lucene/demo/IndexFiles


Put another way, I have downloaded Lucene and I'm trying to do the
demo application. [1] You are suppose to put the .jar files in your
classpath and then run java org.apache.lucene.demo.IndexFiles. What
am I doing wrong?

[1] http://lucene.apache.org/java/2_3_0/demo.html

--
Eric Lease Morgan


Re: [CODE4LIB] arg! classpaths!

2008-01-26 Thread Galen Charlton
Hi,

On Jan 26, 2008 8:30 AM, Eric Lease Morgan [EMAIL PROTECTED] wrote:
 (Arg! Classpaths!)

 Please tell me why Java throws the NoClassDefFoundError error when I
 think I have set up my classpath correctly:

 $ pwd
 /home/eric/lucene
 $ ls -lh
 total 720K
 -rw-r--r-- 1 eric eric 650K 2008-01-26 08:30 lucene-core-2.3.0.jar
 -rw-r--r-- 1 eric eric  52K 2008-01-26 08:30 lucene-demos-2.3.0.jar

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.

Regards,

Galen Charlton
[EMAIL PROTECTED] AKA [EMAIL PROTECTED]


Re: [CODE4LIB] arg! classpaths! [resolved]

2008-01-26 Thread Eric Lease Morgan

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]

2008-01-26 Thread Godmar Back
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]

2008-01-26 Thread Godmar Back
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


Re: [CODE4LIB] arg! classpaths!

2008-01-26 Thread Erik Hatcher

Sadly the Lucene demo is not all that great.

I recommend you start with Solr rather than Lucene directly.

   Erik

On Jan 26, 2008, at 9:30 AM, Eric Lease Morgan wrote:


(Arg! Classpaths!)

Please tell me why Java throws the NoClassDefFoundError error when I
think I have set up my classpath correctly:

$ pwd
/home/eric/lucene
$ ls -lh
total 720K
-rw-r--r-- 1 eric eric 650K 2008-01-26 08:30 lucene-core-2.3.0.jar
-rw-r--r-- 1 eric eric  52K 2008-01-26 08:30 lucene-demos-2.3.0.jar
$ export CLASSPATH=$PWD:.
$ echo $CLASSPATH
/home/eric/lucene:.
$ java org.apache.lucene.demo.IndexFiles
Exception in thread main java.lang.NoClassDefFoundError: org/apache/
lucene/demo/IndexFiles


Put another way, I have downloaded Lucene and I'm trying to do the
demo application. [1] You are suppose to put the .jar files in your
classpath and then run java org.apache.lucene.demo.IndexFiles. What
am I doing wrong?

[1] http://lucene.apache.org/java/2_3_0/demo.html

--
Eric Lease Morgan


Re: [CODE4LIB] conference travel share -- portland to seattle?

2008-01-26 Thread Schneider, Wayne
I'm not sure what your budget is, but I'm taking Amtrak to Seattle after
the conference, one-way for about $25.00 (with AAA discount).  Both the
Portland and Seattle train stations are in the downtown areas.  I've
ridden this train before; it's a nice, relaxed ride.  I don't remember
all the options, but I think there are at least 3 trains a day.

wayne

-Original Message-
From: Code for Libraries [mailto:[EMAIL PROTECTED] On Behalf Of
Jonathan Rochkind
Sent: Friday, January 25, 2008 4:49 PM
To: CODE4LIB@listserv.nd.edu
Subject: [CODE4LIB] conference travel share -- portland to seattle?


Are there any Code4Lib 08 conference attendees that will be returning
via automobile from Portland to Seattle WA after the conference, and
want to let me share their ride for appropriate cost share?

I am going to vacation for a few days in Seattle after the conference,
and am trying to figure out the best/cheapest/easiest way to get there.

Jonathan

--
Jonathan Rochkind
Digital Services Software Engineer
The Sheridan Libraries
Johns Hopkins University
410.516.8886
rochkind (at) jhu.edu