Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / First Aid / September 2006

Tip: Looking for answers? Try searching our database.

Trouble compiling from command-line

Thread view: 
Hendrik Maryns - 31 Aug 2006 10:50 GMT
Hi all,

I have a rather large project which gives no errors in Eclipse.
However, if I try to compile it from the command line, I get a huge
bunch of errors.

I pick out a few:
org/apache/commons/collections/ClosureUtils.java:196: cannot find symbol
symbol  : method
getInstance(org.apache.commons.collections.Closure<capture of ? super
I>,org.apache.commons.collections.Closure<capture of ? super I>)
location: class org.apache.commons.collections.functors.ChainedClosure
       return ChainedClosure.getInstance(closure1, closure2);
                            ^
Whereas ChainedClosure definitely contains
   /**
    * Factory method that performs validation.
    *
    * @param closure1  the first closure, not null
    * @param closure2  the second closure, not null
    * @return the <code>chained</code> closure
    * @throws IllegalArgumentException if either closure is null
    */
   @SuppressWarnings("unchecked")
   public static <I> Closure<I> getInstance(Closure<? super I>
closure1, Closure<? super I> closure2) {
       if (closure1 == null || closure2 == null) {
           throw new IllegalArgumentException("Closures must not be
null");
       }
       Closure<I>[] closures = new Closure[] { closure1, closure2 };
       return new ChainedClosure<I>(closures);
   }

There are quite a lot of these messages.

Another common error is this one:
org/apache/commons/collections/ComparatorUtils.java:57: incompatible
types; inferred type argument(s) java.lang.Comparable<? super T> do not
conform to bounds of type variable(s) T
found   :
<T>org.apache.commons.collections.comparators.ComparableComparator<T>
required: java.util.Comparator
   public static final Comparator NATURAL_COMPARATOR =
ComparableComparator.getInstance();
                               ^

But ComparableComparator is defined like so:
public class ComparableComparator<T extends Comparable<? super T>>
implements Comparator<T>, Serializable {...

And there are more errors of this style:
org/apache/commons/collections/PredicateUtils.java:261:
<T>getInstance(org.apache.commons.collections.Predicate<? super
T>,org.apache.commons.collections.Predicate<? super T>) in
org.apache.commons.collections.functors.AndPredicate cannot be applied
to (org.apache.commons.collections.Predicate<capture of ? super
T>,org.apache.commons.collections.Predicate<capture of ? super T>)
       return AndPredicate.getInstance(predicate1, predicate2);
                          ^

This is javac:
javac -version
javac 1.5.0_07

Eclipse uses another javac (IBM’s), but it gives the same errors from
the command line.

I would be very pleased to get some hints about what I am doing wrong.

I invoke it like so:
hendrik@lichtenstein:~/Java/Jakarta Commons
Collections/commons-collections-generic-3.2-src/src/java> javac
- -classpath . org/apache/commons/collections/FunctorUtils.java

Thanks, H.

- --
Hendrik Maryns

==================
http://aouw.org
Ask smart questions, get good answers:
http://www.catb.org/~esr/faqs/smart-questions.html
Redbeard - 02 Sep 2006 05:33 GMT
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
[quoted text clipped - 90 lines]
> =/V6V
> -----END PGP SIGNATURE-----
I appears that your project is using some external libraries.  I
suspect that Eclipse is setting paths to those for you, and that you
aren't setting those same paths when you use javac.
Hendrik Maryns - 04 Sep 2006 11:14 GMT
Redbeard schreef:
> Hi all,
>
[quoted text clipped - 9 lines]
> location: class org.apache.commons.collections.functors.ChainedClosure
>         return ChainedClosure.getInstance(closure1, closure2);

<snip more error messages>

> I invoke it like so:
> hendrik@lichtenstein:~/Java/Jakarta Commons
> Collections/commons-collections-generic-3.2-src/src/java> javac
> -classpath . org/apache/commons/collections/FunctorUtils.java

> I appears that your project is using some external libraries.  I
> suspect that Eclipse is setting paths to those for you, and that you
> aren't setting those same paths when you use javac.

I don’t think so.  The Java Build Path mentions only the project itself
and the jdk.

All the classes mentioned in the error messages are in
org/apache/commons/collections/ and its subdirs, seen from ., which I
add to the classpath as above.

Other suggestions?

H.
- --
Hendrik Maryns

==================
http://aouw.org
Ask smart questions, get good answers:
http://www.catb.org/~esr/faqs/smart-questions.html
Andrew Thompson - 04 Sep 2006 11:31 GMT
...
> Other suggestions?

Shot in the dark  (probably not the slightest bit relevant).

I noticed that all your code causing problems, uses generics.

Are you sure that the other compilers are expecting code
that uses generics?  (I vaguely recall having to tell the 1.5
javac to expect generics based code, but forget the minor
details).

Andrew T.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.