Re: [問題] JAVA程式讀的到資料卻沒辦法執行

作者: TonyQ (自立而後立人。)   2014-06-26 12:46:24
※ 引述《DJJERRY (鍵盤張根碩)》之銘言:
: 各位版上的高手好 小弟我從網路上找了範例想在eclipse上執行
: 現在的問題是有辦法讀資料 卻沒辦法執行 一直出現以下錯誤訊息
: Exception in thread "main" java.lang.Error: Unresolved compilation problem:
: The method run(Configuration, Path, Path, Path, double, int, boolean,
: double, boolean)
: in the type KMeansDriver is not applicable for the arguments
: (Configuration, Path, Path, Path, EuclideanDistanceMeasure, double, int,
: boolean, boolean)
: 附上程式碼http://i.imgur.com/QWJabHE.png
: 不知道是什麼地方出了問題 求各位大大幫忙~
其實如推文所說,我們會建議應該要學著解讀錯誤訊息:
以這個例子我們只要讀出錯誤訊息就知道怎麼回事了:
: Exception in thread "main" java.lang.Error:
在 main 這個程式執行序(就是預設跑程式的東東),碰到了 Error:
Unresolved compilation problem:
待解決的相容問題
: The method run(Configuration, Path, Path, Path, double, int, boolean,
: double, boolean)
: in the type KMeansDriver is not applicable for the arguments
: (Configuration, Path, Path, Path, EuclideanDistanceMeasure, double, int,
: boolean, boolean)
KMeanDriver 有個叫 run 的方法(method) 需要九個參數,
依序是 Configuration, Path, Path, Path, double, int,
boolean, double, boolean 這九種類別。
但你給他的是
(Configuration, Path, Path, Path, EuclideanDistanceMeasure,
double, int, boolean, boolean)
不一致,所以會建議去看看您引用套件所屬版本的 javadoc 如何說。
以我的查到的資料而言
http://goo.gl/1n5BKC
run(Path input, Path clustersIn, Path output, DistanceMeasure measure,
double convergenceDelta, int maxIterations, boolean runClustering,
double clusterClassificationThreshold, boolean runSequential)
因為他的確是有過這樣的 api 介面,
我會建議您去查查不是您用的 mahout 版本與您看到的範例不一致。
我對 mahout 不熟,但從 javadoc 來看,
至少 mahout 0.8 版是能夠跑你要跑的程式碼,
你可能可以查查是不是 mahout 太舊或是後來有改版改過介面,
再從最新版的教學指引下手這樣,這大概會是我們解決這種問題的可能思路。:)
作者: realmeat (真肉)   2014-06-26 16:06:00
ide已經有提醒語法錯誤
作者: NullLife (廢材大叔有點累)   2014-07-02 01:19:00
推版大詳細解說

Links booklink

Contact Us: admin [ a t ] ucptt.com