log4j requires Xbootclasspath ??

R

Rene

Hello,

I just stumbled upon a strange occurence. For a relativ simple project I
need to use log4j (even though under jdk 1.4, or more specifically, SUN
java 2 sdk build 1.4.2_03-b02 under SuSE Linux 9.1)

I'm running this as root at the moment, so there is no rights problem.

When I start the little application (which does *not* have own
classloaders) via -classpath I get the following:

#java -classpath /root/log4j-1.2.8.jar -jar suad.jar
Exception in thread "main" java.lang.NoClassDefFoundError:
org/apache/log4j/Logger
at [..]

When I however start it with -Xbootclasspath/a, it loads ok:
#java -Xbootclasspath/a:/root/log4j-1.2.8.jar -jar suad.jar
starting suad...
[..]

I've tried locating a problem with -verbose but I don't find an early call
going wrong or any other problem. Since I didn't find any hint to that
behaviour I'm probably just not seeing the obvious here - so any hints
appreciated to let me run it with -cp (I can of course let it the way it is
now but I don't see a reason why log4j needs to be available at
bootstrapping time)

TIA

CU

René
 
M

Manfred Rosenboom

Hi,

the -jar option disables the usage of the -classpath option.
I see two solutions for your problem:

Either add the full pathname of your log4j jar file to the
manifest of your jar file (attribute Class-Path) or don't use
the -jar option and add the name of your main class to the
command line.

Best,
Manfred
 
R

Rene

Manfred Rosenboom said:
Hi,

the -jar option disables the usage of the -classpath option.
I see two solutions for your problem:

Either add the full pathname of your log4j jar file to the
manifest of your jar file (attribute Class-Path) or don't use
the -jar option and add the name of your main class to the
command line.

Argh of course. I have a little helper package that I normally use that
sets up the classpath by reading a file and performs some other
initialization stuff, but I cannot use it here. Amazing how fast you get
dependant on such things. Thanks for showing me the trees in the forest
I've been standing in :)

CU

René
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,143
Latest member
SterlingLa
Top