0
我是使用aspectj的新手,如果這是一個非常簡單的問題,我非常抱歉。但即使經過長達數天的互聯網搜索,我仍然無法解決問題。我有一個使用Eclipse創建的aspectj項目。它完美運行並在Eclipse中編譯。我也可以通過Eclipse創建一個有效的可運行jar。
不幸的是,我無法在命令行上編譯同一個項目。這裏是編譯錯誤:在Eclipse中編譯時,Aspectj項目不能在終端上編譯
[email protected]:~/workspace/FirstAspectJProject/src/hello$ ajc World.aj HelloWorld.java
/home/egeyar/workspace/FirstAspectJProject/src/hello/World.aj:75 [error] Type mismatch: cannot convert from int to Object
objList[i]=list[i]; //copy to object list in order to use Arrays.deepToString
^^
/home/egeyar/workspace/FirstAspectJProject/src/hello/World.aj:85 [error] Type mismatch: cannot convert from char to Object
objList[i]=list[i];//copy to object list in order to use Arrays.deepToString
^^
/home/egeyar/workspace/FirstAspectJProject/src/hello/World.aj:96 [error] Type mismatch: cannot convert from byte to Object
objList[i]=list[i];//copy to object list in order to use Arrays.deepToString
^^
/home/egeyar/workspace/FirstAspectJProject/src/hello/World.aj:107 [error] Type mismatch: cannot convert from short to Object
objList[i]=list[i];//copy to object list in order to use Arrays.deepToString
^^
/home/egeyar/workspace/FirstAspectJProject/src/hello/World.aj:118 [error] Type mismatch: cannot convert from long to Object
objList[i]=list[i];//copy to object list in order to use Arrays.deepToString
^^
/home/egeyar/workspace/FirstAspectJProject/src/hello/World.aj:129 [error] Type mismatch: cannot convert from float to Object
objList[i]=list[i];//copy to object list in order to use Arrays.deepToString
^^
/home/egeyar/workspace/FirstAspectJProject/src/hello/World.aj:140 [error] Type mismatch: cannot convert from double to Object
objList[i]=list[i];//copy to object list in order to use Arrays.deepToString
^^
/home/egeyar/workspace/FirstAspectJProject/src/hello/World.aj:151 [error] Type mismatch: cannot convert from boolean to Object
objList[i]=list[i];//copy to object list in order to use Arrays.deepToString
^^
8 errors
如果有人能給我至少一個提示,我會很高興。在eclipse中接受代碼的原因是什麼,但不是在命令行中?這是一個類路徑錯誤(我什麼都不知道),或者是因爲某些編譯器版本問題等。
能否請您提供源代碼(也許一個下載鏈接,如果它太大了在這裏引用,但最小的失敗的例子會更好),以及有關在Eclipse中使用AspectJ編譯器版本並在命令行? AspectJ編譯器的Eclipse設置也很有用。那麼也許有人可以複製它並幫助你。 – kriegaex