I'm using Eclipse on a Windows 7 64x machine. I've researched this problem and found many have had a similar one, but no solution I came across quite worked for me.
I'm working on a Project named
Assignment_1
Percolation
WeightedQuickUnionUF
algs4.jar
algs4.jar
lib
WeightedQuickUnionUF
WeightedQuickUnionUF
import
import WeightedQuickUnionUF
so and so
import
WeightedQuickUnionUF
package assignment_1_package;
import algs4.WeightedQuickUnionUF;
public class Percolation {
private int[][] grid;
public int gridDimension;
private int opensGrid[][];
private WeightedQuickUnionUF model;
... //rest of class body here
Assuming you are talking about the algs4.jar of the class http://algs4.cs.princeton.edu/code/ , your import is incorrect you should do :
import WeightedQuickUnionUF;
BUT it's never a good idea to have class in the default package and it's actually not allowed to import a type from the unnamed package: this gives a compilation error. http://docs.oracle.com/javase/specs/jls/se5.0/html/packages.html#7.4.2:
A type-import-on-demand declaration (§7.5.2) imports all the accessible (§6.6) types of a named type or package as needed. It is a compile time error to import a type from the unnamed package.
So in your case to solve your issue just create your classes in the default package so you don't have to do the import at all.