我是使用 aspectj 的新手,如果这是一个非常简单的问题,我感到非常抱歉。但即使经过几天的互联网搜索,我也无法解决问题。我有一个使用 Eclipse 创建的 aspectj 项目。它在 Eclipse 中完美运行和编译。我还可以通过 Eclipse 创建一个有效的可运行 jar。
不幸的是,我无法在命令行上编译相同的项目。这是编译错误:
egeyar@paris:~/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 中接受代码但在命令行中接受代码的原因可能是什么?它是一个类路径错误(我对此一无所知),还是因为一些编译器版本问题等等。