2012-02-02 101 views
0
package aa; 

import java.io.BufferedReader; 
import java.io.FileReader; 
import java.io.IOException; 
import java.util.ArrayList; 
import java.util.HashMap; 
import java.util.List; 
import aa.*; 
import aa.Mapper; 
import aa.Reducer; 

/** 
* Some example code on how to use the MapReduce Framework 
*/ 
public class Example2 implements Mapper, Reducer 
{ 
} 

以下錯誤我得到下面。我不確定錯誤是什麼。我已經將Mapper和Reducer包含在同一個軟件包中。Java錯誤(找不到符號)

Example2.java:10: error: cannot find symbol 
import aa.Mapper; 
     ^
    symbol: class Mapper 
    location: package aa 
Example2.java:11: error: cannot find symbol 
import aa.Reducer; 
     ^
    symbol: class Reducer 
    location: package aa 
Example2.java:16: error: cannot find symbol 
+1

文件名與類/接口名稱匹配嗎?顯示Mapper和Reducer的代碼和文件名以及您嘗試編譯的全部輸出 – hvgotcodes 2012-02-02 15:00:33

回答

0

您的課程與Mapper和Reducer包裝相同。 你不需要導入它們。

+0

但是我仍然收到以下錯誤Example2.java:13:error:can not find symbol public class Example2 implements Mapper,Reducer 符號:class Mapper Example2.java:13:錯誤:無法找到符號 – 2012-02-02 14:58:09

+0

您是否已將Mapper和Reducer放入Example2的**相同目錄**中的兩個不同文件(Mapper.java和Reducer.java)中。 java? – onof 2012-02-02 15:03:28

+1

我已經從這裏得到了我的答案,謝謝。 http://stackoverflow.com/questions/5998053/cannot-find-symbol-for-my-own-class – 2012-02-02 15:08:02

0

您確定您的類路徑中包含所有類文件嗎? ;)

0

你的班級在同一個目錄下,所以不需要導入它們。檢查您的班級文件MapperReducer,它們是否位於aa目錄內。