Re: [jnc-users] Undefined reference :: Log4j
Status: Beta
Brought to you by:
soapy
From: Marco T. <mt...@gm...> - 2007-08-30 08:32:07
|
Hey Ariel chosen forsaken wrote: > Hi, > > I'm trying to create a simple program that uses log4j. Unfortunately, I > can't seem to make it work. I've used 2 methods in creating the EXE: > > A. Using the JNC UI: > 1. In Step 1, I indicated my the .java file of my program (in Files), > the directory of my program (in Directories), and the log4j jar located > in my program's directory (in Archives). > 2. In Step 2, I set the main class by selecting my (only) java file. > I only checked the Windows checkbox, and left everything else blank. > 3. In Step 3, the only thing I enabled is the Show used commands > checkbox. > 4. When I try to compile my project (Step 4) I get an error : > > org/apache/log4j/jmx/Agent.java: In class > 'org.apache.log4j.jmx.Agent': > org/apache/log4j/jmx/Agent.java: In method > 'org.apache.log4j.jmx.Agent.start()': > org/apache/log4j/jmx/Agent.java:0: error: cannot find file for class > com.sun.jdmk.comm.HtmlAdaptorServer > org/apache/log4j/jmx/Agent.java:0: confused by earlier errors, > bailing out > > while it's "processing log4j-1.2.13.jar". It seems that no .o > file for my program was generated since it hasn't processed my program yet. Try using "-findirect-dispatch" as custom GCJ flag in the GUI. > B. Using the command line > 1. I tried compiling my .java file using the command: > gcj -c -g --classpath=C:\logtest\log4j-1.2.13.jar LogTest.java -o > LogTest.o > and it generated a LogTest.o file. > 2. Then I tried to build the EXE using the command: > gcj --main=test.gcj.LogTest -fjni -Llibs/win > -Ilibs/win/gui/gui.jar -o C:\logtest\LogTest.exe -s -O2 -ljncNoGui > -ljncNoJce -ljncTrial -IC:\logtest LogTest. > and it shows an error : > LogTest.o: In function `ZN4test3gcj7LogTest18__U3c_clinit(unsigned > e_E, __complex void, void)':C:/logtest/test/gcj/LogTest.java:8: > undefined reference to `org::a > ache::log4j::Logger* > org::apache::log4j::Logger::getLogger(java::lang::String*)' > :C:/logtest/test/gcj/LogTest.java:8: undefined reference to > `org::apache::log4j::Logger::class$' > collect2: ld returned 1 exit status Don't work with the command line version unless you know exactly what you're doing. You'll be well off using the GUI. Marco |