[crossfire] Compiling jxclient with ant

Kevin R. Bulgrien kbulgrien at worldnet.att.net
Sat Aug 4 17:19:56 CDT 2007


Using Mandriva 2007.0 x86_86

  $ rpm -q jdk
  jdk-1.6.0_02-fcs

I see 1.5 is minimum on Sun's stuff, but I don't know what the significance
of ant's depends are on this distribution.  My first attempt at getting ant
installed didn't work.  In the past I've had trouble with the gcj-compat
stuff, so I took a wrong turn at the outset.

  $ sudo urpmi ant
  One of the following packages is needed:
   1- java-1.4.2-gcj-compat-devel-1.4.2.0-40.103.1mdv2007.0.x86_64 : JPackage development scripts for GCJ (to install)
   2- kaffe-devel-1.1.7-1mdk.x86_64 : Development package with static libs and headers for kaffe (to install)
  What is your choice? (1-2) 2
  To satisfy dependencies, the following packages are going to be installed
  ant-1.6.5-21mdv2007.0.x86_64
  antlr-2.7.6-4.1mdv2007.0.x86_64
  bouncycastle-1.33-3mdv2007.0.x86_64
  bouncycastle-jdk1.4-1.33-3mdv2007.0.x86_64
  classpath-0.92-3mdv2007.0.x86_64
  classpathx-jaf-1.1.1-1mdv2007.0.x86_64
  classpathx-mail-1.1.1-3mdv2007.0.x86_64
  classpathx-mail-monolithic-1.1.1-3mdv2007.0.x86_64
  eclipse-ecj-3.2.0-12.3mdv2007.0.x86_64
  gcj-tools-4.1.1-3mdk.x86_64
  gjdoc-0.7.7-9mdv2007.0.x86_64
  jamvm-1.4.3-3.1mdv2007.0.x86_64
  java-1.4.2-gcj-compat-1.4.2.0-40.103.1mdv2007.0.x86_64
  jikes-1.23-0.20050308.1mdk.x86_64
  jpackage-utils-1.7.0-1.4mdv2007.0.noarch
  kaffe-1.1.7-1mdk.x86_64
  kaffe-devel-1.1.7-1mdk.x86_64
  lib64gcj7-devel-4.1.1-3mdk.x86_64
  Proceed with the installation of the 18 packages? (84 MB) (Y/n) Y

This gave me:

  $ pwd
  /home/data/svn/crossfire/jxclient
  $ ant
  Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/tools/ant/launch/Launcher
  $ cd trunk/com/realtime/crossfire/jxclient/
  $ ant
  Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/tools/ant/launch/Launcher
  $ cd ../../../../../trunk/src/test/com/realtime/crossfire/jxclient/
  $ ant
  Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/tools/ant/launch/Launcher

Googling the above message resulted in a suggestion for troubleshooting.

  $ ant --execdebug
  exec "/usr/java/jdk1.5.0_08/bin/java" -classpath "/usr/bin/build-classpath: error: JVM_LIBDIR /usr/lib/jvm-exports/java-gcj does not exist or is not a directory" -Dant.home="/usr/share/ant" -Dant.library.dir="/usr/share/ant/lib" org.apache.tools.ant.launch.Launcher -cp ""
  Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/tools/ant/launch/Launcher

Ok, so problem is in the tool chain probably, since it is missing stuff in /usr/lib.  On a hunch, I pull out
kaffe and kaffe-devel and start over.

  $ sudo urpme kaffe kaffe-devel
  To satisfy dependencies, the following 3 packages will be removed (19 MB):
  ant-1.6.5-21mdv2007.0.x86_64
   (due to missing java-devel)
  kaffe-1.1.7-1mdk.x86_64
  kaffe-devel-1.1.7-1mdk.x86_64
   (due to unsatisfied java-1.4.2-kaffe == 0:1.4.2.00-1mdk,
    due to unsatisfied kaffe == 0:1.1.7-1mdk)
  Remove 3 packages? (y/N) y
  removing ant-1.6.5-21mdv2007.0.x86_64 kaffe-1.1.7-1mdk.x86_64 kaffe-devel-1.1.7-1mdk.x86_64

And re-install ant using the other choice.

  $ sudo urpmi ant
  One of the following packages is needed:
   1- java-1.4.2-gcj-compat-devel-1.4.2.0-40.103.1mdv2007.0.x86_64 : JPackage development scripts for GCJ (to install)
   2- kaffe-devel-1.1.7-1mdk.x86_64 : Development package with static libs and headers for kaffe (to install)
  What is your choice? (1-2) 1
  One of the following packages is needed:
   1- xml-commons-resolver10-1.3.03-5.1mdv2007.0.x86_64 : XmlResolver 1.0 utility from xml-commons (to install)
   2- xml-commons-resolver11-1.3.03-5.1mdv2007.0.x86_64 : XmlResolver 1.1 utility from xml-commons (to install)
   3- xml-commons-resolver12-1.3.03-5.1mdv2007.0.x86_64 : XmlResolver 1.2 from xml-commons (to install)
  What is your choice? (1-3) 3
  To satisfy dependencies, the following packages are going to be installed:
  ant-1.6.5-21mdv2007.0.x86_64
  gcc-java-4.1.1-3mdk.x86_64
  java-1.4.2-gcj-compat-devel-1.4.2.0-40.103.1mdv2007.0.x86_64
  xalan-j2-2.7.0-2.2mdv2007.0.x86_64
  xerces-j2-2.8.0-1mdv2007.0.x86_64
  xml-commons-1.3.03-5.1mdv2007.0.x86_64
  xml-commons-resolver12-1.3.03-5.1mdv2007.0.x86_64
  Proceed with the installation of the 7 packages? (26 MB) (Y/n) y

Progress... but still no cigar...

  $ ant
  /usr/bin/build-classpath: error: Could not find xml-commons-apis Java extension for this JVM
  /usr/bin/build-classpath: error: Some specified jars were not found
  Buildfile: build.xml

  init:

  compile:
     [delete] Deleting directory /home/data/svn/crossfire/jxclient/trunk/build/jxclient
      [mkdir] Created dir: /home/data/svn/crossfire/jxclient/trunk/build/jxclient
      [javac] Compiling 115 source files to /home/data/svn/crossfire/jxclient/trunk/build/jxclient
      [javac] Compliance level '1.4' is incompatible with target level '1.5'. A compliance level '1.5' or better is required

  BUILD FAILED
  /home/data/svn/crossfire/jxclient/trunk/build.xml:12: Compile failed; see the compiler error output for details.

  Total time: 1 second

Ok, something else is missing...

  $ sudo urpmi xml-commons-apis
  One of the following packages is needed:
   1- xml-commons-jaxp-1.1-apis-1.3.03-5.1mdv2007.0.x86_64 : JAXP 1.1, DOM2, SAX2, SAX2-ext 1.0 apis (to install)
   2- xml-commons-jaxp-1.2-apis-1.3.03-5.1mdv2007.0.x86_64 : JAXP 1.2, DOM 2, SAX 2.0.1, SAX2-ext 1.0 apis (to install)
   3- xml-commons-jaxp-1.3-apis-1.3.03-5.1mdv2007.0.x86_64 : JAXP 1.3, DOM 2, SAX 2.0.1, SAX2-ext 1.0 apis (to install)
  What is your choice? (1-3) 3

  $ ant
  Buildfile: build.xml

  init:

  compile:
     [delete] Deleting directory /home/data/svn/crossfire/jxclient/trunk/build/jxclient
      [mkdir] Created dir: /home/data/svn/crossfire/jxclient/trunk/build/jxclient
      [javac] Compiling 115 source files to /home/data/svn/crossfire/jxclient/trunk/build/jxclient
      [javac] Compliance level '1.4' is incompatible with target level '1.5'. A compliance level '1.5' or better is required

  BUILD FAILED
  /home/data/svn/crossfire/jxclient/trunk/build.xml:12: Compile failed; see the compiler error output for details.

  Total time: 1 second

I don't quite understand the compliance level complaint...

  $ javac -version
  javac 1.5.0_08

Hmm...  The following might have something to do with it...

  bouncycastle-jdk1.4-1.33-3mdv2007.0
  jpackage-utils-1.7.0-1.4mdv2007.0
  jamvm-1.4.3-3.1mdv2007.0
  java-1.4.2-gcj-compat-1.4.2.0-40.103.1mdv2007.0
  java-1.4.2-gcj-compat-devel-1.4.2.0-40.103.1mdv2007.0

This is getting complicated.  the java-1.4.2-gcj-compat stuff is required by the
distribution because it doesn't supply Sun's java.

<snip>

Hours later... This did the trick...

$ export JAVA_HOME=/usr/java/latest
$ ant --execdebug

$ ant --execdebug
exec "/usr/java/latest/jre/bin/java" -classpath "/usr/bin/build-classpath: error: JAVAVER_JNIDIR /usr/lib/java-1.6.0 does not exist or is not a directory:/usr/bin/build-classpath: error: JAVAVER_JNIDIR /usr/lib/java-1.6.0 does not exist or is not a directory:/usr/java/latest/lib/tools.jar" -Dant.home="/usr/share/ant" -Dant.library.dir="/usr/share/ant/lib" org.apache.tools.ant.launch.Launcher -cp ""
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/tools/ant/launch/Launcher

$ sudo mkdir /usr/lib/java-1.6.0

Who knows why the above was needed... No clue, but it was looking for the
directory and could not find it.  Simply making it gets the build to actually
start and fail due to unfound resources..

$ ant --execdebug
exec "/usr/java/latest/jre/bin/java" -classpath "/usr/bin/build-classpath: error: JAVAVER_JNIDIR /usr/lib/java-1.6.0 does not exist or is not a directory:/usr/bin/build-classpath: error: JAVAVER_JNIDIR /usr/lib/java-1.6.0 does not exist or is not a directory:/usr/java/latest/lib/tools.jar" -Dant.home="/usr/share/ant" -Dant.library.dir="/usr/share/ant/lib" org.apache.tools.ant.launch.Launcher -cp ""
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/tools/ant/launch/Launcher
[krb at kraymd64 trunk]$ ant --execdebug
exec "/usr/java/latest/jre/bin/java" -classpath "/usr/bin/build-classpath: error: JAVAVER_JNIDIR /usr/lib/java-1.6.0 does not exist or is not a directory:/usr/java/latest/lib/tools.jar" -Dant.home="/usr/share/ant" -Dant.library.dir="/usr/share/ant/lib" org.apache.tools.ant.launch.Launcher -cp ""
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/tools/ant/launch/Launcher
[krb at kraymd64 trunk]$ ant --execdebug
exec "/usr/java/latest/jre/bin/java" -classpath "/usr/share/java/ant.jar:/usr/share/java/ant-launcher.jar:/usr/share/java/jaxp_parser_impl.jar:/usr/share/java/xml-commons-apis.jar:/usr/java/latest/lib/tools.jar" -Dant.home="/usr/share/ant" -Dant.library.dir="/usr/share/ant/lib" org.apache.tools.ant.launch.Launcher -cp ""
Buildfile: build.xml

init:

compile:
   [delete] Deleting directory /home/data/svn/crossfire/jxclient/trunk/build/jxclient
    [mkdir] Created dir: /home/data/svn/crossfire/jxclient/trunk/build/jxclient
    [javac] Compiling 115 source files to /home/data/svn/crossfire/jxclient/trunk/build/jxclient
    [javac] /home/data/svn/crossfire/jxclient/trunk/src/test/com/realtime/crossfire/jxclient/gui/log/ParserTest.java:23: package junit.framework does not exist
    [javac] import junit.framework.Test;
    [javac]                       ^
    [javac] /home/data/svn/crossfire/jxclient/trunk/src/test/com/realtime/crossfire/jxclient/gui/log/ParserTest.java:24: package junit.framework does not exist
    [javac] import junit.framework.TestCase;
    [javac]                       ^
    [javac] /home/data/svn/crossfire/jxclient/trunk/src/test/com/realtime/crossfire/jxclient/gui/log/ParserTest.java:25: package junit.framework does not exist
    [javac] import junit.framework.TestSuite;
    [javac]                       ^
    [javac] /home/data/svn/crossfire/jxclient/trunk/src/test/com/realtime/crossfire/jxclient/gui/log/ParserTest.java:26: package junit.textui does not exist
    [javac] import junit.textui.TestRunner;
    [javac]                    ^
    [javac] /home/data/svn/crossfire/jxclient/trunk/src/test/com/realtime/crossfire/jxclient/gui/log/ParserTest.java:33: cannot find symbol
    [javac] symbol: class TestCase
    [javac] public class ParserTest extends TestCase
    [javac]                                 ^
    [javac] /home/data/svn/crossfire/jxclient/trunk/src/test/com/realtime/crossfire/jxclient/gui/log/ParserTest.java:55: cannot find symbol
    [javac] symbol  : class Test
    [javac] location: class com.realtime.crossfire.jxclient.gui.log.ParserTest
    [javac]     public static Test suite()
    [javac]                   ^
    [javac] /home/data/svn/crossfire/jxclient/trunk/src/test/com/realtime/crossfire/jxclient/gui/log/ParserTest.java:57: cannot find symbol
    [javac] symbol  : class TestSuite
    [javac] location: class com.realtime.crossfire.jxclient.gui.log.ParserTest
    [javac]         return new TestSuite(ParserTest.class);
    [javac]                    ^
    [javac] /home/data/svn/crossfire/jxclient/trunk/src/test/com/realtime/crossfire/jxclient/gui/log/ParserTest.java:67: cannot find symbol
    [javac] symbol  : variable TestRunner
    [javac] location: class com.realtime.crossfire.jxclient.gui.log.ParserTest
    [javac]         TestRunner.run(suite());
    [javac]         ^
    [javac] /home/data/svn/crossfire/jxclient/trunk/src/test/com/realtime/crossfire/jxclient/gui/log/ParserTest.java:294: cannot find symbol
    [javac] symbol  : method assertEquals(java.lang.String,java.lang.String)
    [javac] location: class com.realtime.crossfire.jxclient.gui.log.ParserTest
    [javac]         assertEquals(expected, dumpBuffer());
    [javac]         ^
    [javac] 9 errors

BUILD FAILED
/home/data/svn/crossfire/jxclient/trunk/build.xml:12: Compile failed; see the compiler error output for details.

Total time: 4 seconds

$ urpmq --fuzzy junit
ant-junit
junit
junit-demo
junit-javadoc
junit-manual

$ sudo urpmi ant-junit
To satisfy dependencies, the following packages are going to be installed:
ant-junit-1.6.5-21mdv2007.0.x86_64
junit-3.8.2-1.1mdv2007.0.x86_64
Proceed with the installation of the 2 packages? (2 MB) (Y/n) y

$ cd /home/data/svn/crossfire/jxclient/trunk
$ ant
Buildfile: build.xml

init:

compile:
   [delete] Deleting directory /home/data/svn/crossfire/jxclient/trunk/build/jxclient
    [mkdir] Created dir: /home/data/svn/crossfire/jxclient/trunk/build/jxclient
    [javac] Compiling 115 source files to /home/data/svn/crossfire/jxclient/trunk/build/jxclient

skin.prelude:
     [copy] Copying 188 files to /home/data/svn/crossfire/jxclient/trunk/build/skin.prelude/com/realtime/crossfire/jxclient/skins/default
      [jar] Building jar: /home/data/svn/crossfire/jxclient/trunk/jxcskin_prelude.jar

jar:
      [jar] Building jar: /home/data/svn/crossfire/jxclient/trunk/jxclient.jar

all:

BUILD SUCCESSFUL
Total time: 7 seconds

Bingo!

$ bash run.sh

The GPU cooler comes on...  Ah... yes... there it is...  Yup, crossfire.metalforge.com

Hmm... So... JAVA_HOME and xml-commons-api, junit, ant-junit packages and the 
inexplicable mkdir are key for Mandriva.  Does anyone care if I markup the readme
a bit?  Especially with the part about --execdebug?



More information about the crossfire mailing list