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


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

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

From Lew <lewbloch@gmail.com>
Newsgroups comp.lang.java.programmer
Subject Re: the classes in rt.jar cannot be found during ant build
Date 2012-04-02 15:53 -0700
Organization http://groups.google.com
Message-ID <29434054.1356.1333407212535.JavaMail.geo-discussion-forums@pbcvg9> (permalink)
References <21704562.1053.1333400837411.JavaMail.geo-discussion-forums@ynlt15>

Show all headers | View raw


zyng wrote:
> In my build.xml,
>          <property environment="env"/> 
>          ...
>         <path id="project.classpath">
>             <fileset dir="${env.JAVA_HOME}">
>                 <include name="jre/lib/rt.jar"/>
>             </fileset>
>             ...
> 
> The environment variable JAVA_HOME has been set to: C:\Program Files\Java\jdk1.6.0_24
> 
> When I run it, those classes inside rt.jar cannot be found. I have print out, using echo, the classpath and rt.jar is included in the classpath.
> 
> I don't understand why the classes in rt.jar cannot be reached by javac.

You don't give a complete example, for which you should follow the advice given here:
http://sscce.org/

Did you use a "<classpath refid='...'>" element or "classpathrefid='...'" attribute to the "<javac>" element that refers to your path id?

You should not include rt.jar in a regular classpath anyway. That's wrong. It's a bootclasspath JAR. In fact, you shouldn't have to refer to it explicitly at all unless you're cross-compiling between Java versions.

Give us an SSCCE.

-- 
Lew

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