0

This is for an intro course to Java, we are just learning about svn and what not. When I wrote and executed the program on eclipse it ran fine, I wanted to double check on command prompt after committing it to svn, but it returned the below error instead.

javac -d bin/ src/a0/Cfiltering.java src/driver/CfilteringDriver.java 

src/a0/Cfiltering.java:267: cannot find symbol
symbol  : method compare(int,int)
location: class java.lang.Integer
        return Integer.compare(ints[0] * 10 + ints[1],
                  ^
src/a0/Cfiltering.java:333: cannot find symbol
symbol  : method compare(int,int)
location: class java.lang.Integer
        return Integer.compare(ints[0] * 10 + ints[1],
                  ^
2 errors

I have no idea why this happens, the original code that caused the error is here:

Collections.sort(resultList, new Comparator<int[]>() {
  public int compare(int[] ints, int[] otherInts) {
    return Integer.compare(ints[0] * 10 + ints[1],
        otherInts[0] * 10 + otherInts[1]);
  }
});

Here are my imports:

import java.text.DecimalFormat;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.ArrayList;
import java.util.List;
import java.lang.Integer;
Nick
  • 1,161
  • 1
  • 12
  • 22
  • Looks like you're not using Java 7 (or Java 8). – Tom May 24 '16 at 00:12
  • Both school and my machine are on Java7, however mine is on "1.7.0_80" and school is on "1.7.0_79". Do you think that is the problem? – Nick May 24 '16 at 00:13
  • And you're using the correct [compliance level](http://stackoverflow.com/questions/22584427/what-is-compiler-compliance-level-in-eclipse)? – Tom May 24 '16 at 00:14
  • I only have java7 installed on my machine – Nick May 24 '16 at 00:17
  • That's not what I asked. – Tom May 24 '16 at 00:22
  • Sorry, took me a while to figure out what compliance means, everything is set to 1.7 – Nick May 24 '16 at 00:27
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/112727/discussion-between-gptt916-and-tom). – Nick May 24 '16 at 00:30
  • Have you already tried to compile the code using the console? – Tom May 24 '16 at 01:10
  • 1
    So, your problem is eclipse itself. Check the selected JDK, re-check the compliance level, try to clean and rebuild the project, try to re-import the project. – Tom May 24 '16 at 08:11

0 Answers0