Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #13335

Re: the classes in rt.jar cannot be found during ant build

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
From zyng <xsli2@yahoo.com>
Newsgroups comp.lang.java.programmer
Subject Re: the classes in rt.jar cannot be found during ant build
Date Mon, 2 Apr 2012 17:16:39 -0700 (PDT)
Organization http://groups.google.com
Lines 50
Message-ID <21217552.0.1333412199636.JavaMail.geo-discussion-forums@ynfo5> (permalink)
References <21704562.1053.1333400837411.JavaMail.geo-discussion-forums@ynlt15>
NNTP-Posting-Host 72.192.242.74
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1
X-Trace posting.google.com 1333413011 24922 127.0.0.1 (3 Apr 2012 00:30:11 GMT)
X-Complaints-To groups-abuse@google.com
NNTP-Posting-Date Tue, 3 Apr 2012 00:30:11 +0000 (UTC)
In-Reply-To <21704562.1053.1333400837411.JavaMail.geo-discussion-forums@ynlt15>
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=72.192.242.74; posting-account=oo44OQoAAABMDvaRlaO3SeQ5MVbxqLdH
User-Agent G2/1.0
Xref csiph.com comp.lang.java.programmer:13335

Show key headers only | View raw


Below is a more completed build.xml. The error message 

compile:
    [javac] C:\my_work\build.xml:47: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to fals
 for repeatable builds
    [javac] Compiling 407 source files to C:\my_work\build
    [javac] C:\my_work\src\abc\efg\xml\MyXmlUtils.java:27: package com.sun.xml.internal.fastinfoset.stax does not exist
    [javac] import com.sun.xml.internal.fastinfoset.stax.StAXDocumentParser;
    [javac]                                             ^
    [javac] C:\my_work\src\abc\efg\xml\MyXmlUtils.java:28: package com.sun.xml.internal.fastinfoset.stax does not exist
    [javac] import com.sun.xml.internal.fastinfoset.stax.StAXDocumentSerializer;
    [javac]                                             ^
    [javac] C:\my_work\src\abc\efg\xml\MyXmlUtils.java:29: package com.sun.xml.internal.txw2.output does not exist
...

Those packages are located inside rt.jar. (I use Eclipse and I include rt.jar in the project property, so there is no compiling error in Eclipse).

Another observation (only happens in my office computer, not in my home computer) confuses me is that: when I copy rt.jar to rt2.jar which locates in the same directory(C:\Program Files\Java\jdk1.6.0_24\jre\lib) and modify build.xml a bit: 
        <fileset dir="${env.JAVA_HOME}">
                <include name="jre/lib/rt2.jar"/>
        </fileset>

Then ant works! Very confusing. I just re-tested this observation in my home computer and it does not work -- same error message. But this approach does work in my office computer.

<project name="myproject" default="compile" basedir=".">
	<property environment="env"/>
	<property name="build.dir" location="build"/>
	<property name="libs.dir" location="../libs"/>
	<property name="externals.dir" location="${libs.dir}/external"/>
	<property name="install.dir" location="${libs.dir}/installed"/>

	<path id="project.classpath">
        <fileset dir="${env.JAVA_HOME}">
                <include name="jre/lib/rt.jar"/>
        </fileset>
		<pathelement location="${build.dir}"/>
		<fileset dir="${externals.dir}">
			<include name="abc.jar"/>
			<include name="xyz.jar"/>
			<include name="junit.jar"/>
		</fileset>
	</path>

	<target name="compile">
		<javac srcdir="${src.dir}" destdir="${build.dir}" compiler="modern" fork="yes" debug="on">
			<classpath refid="project.classpath"/>
			<compilerarg value="-Xlint"/>
		</javac>
	</target>
</project>

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

the classes in rt.jar cannot be found during ant build zyng <xsli2@yahoo.com> - 2012-04-02 14:07 -0700
  Re: the classes in rt.jar cannot be found during ant build Lew <lewbloch@gmail.com> - 2012-04-02 15:53 -0700
  Re: the classes in rt.jar cannot be found during ant build Roedy Green <see_website@mindprod.com.invalid> - 2012-04-02 16:00 -0700
  Re: the classes in rt.jar cannot be found during ant build Arne Vajhøj <arne@vajhoej.dk> - 2012-04-02 19:44 -0400
  Re: the classes in rt.jar cannot be found during ant build zyng <xsli2@yahoo.com> - 2012-04-02 17:16 -0700
    Re: the classes in rt.jar cannot be found during ant build Arne Vajhøj <arne@vajhoej.dk> - 2012-04-02 20:53 -0400
    Re: the classes in rt.jar cannot be found during ant build Roedy Green <see_website@mindprod.com.invalid> - 2012-04-03 10:49 -0700
      Re: the classes in rt.jar cannot be found during ant build Arne Vajhøj <arne@vajhoej.dk> - 2012-04-03 19:15 -0400
    Re: the classes in rt.jar cannot be found during ant build Roedy Green <see_website@mindprod.com.invalid> - 2012-04-03 16:29 -0700

csiph-web