我开始了解AspectJ,我正在研究一些例子。但是,当我运行其中一个时,我的运行失败了:
$ java -cp /c/aspectj1.7/lib/aspectjrt.jar:/c/aspectj1.7/lib/aspectjweaver.jar:. -javaagent:aspectjweaver.jar Simple
Error opening zip file or JAR manifest missing : aspectjweaver.jar
Error occurred during initialization of VM
agent library failed to init: instrument
我在Windows上的MinGW中这样做,我确信罐子在那里。有什么我想念的吗?
答案 0 :(得分:0)
事实证明,即使你在其中使用MinGW和unix路径,你仍然必须以windows方式提供代理的路径记住,但是,反斜杠是Unix中的转义字符,所以你必须逃脱它与另一个反斜杠。
$ java -javaagent:C:\\aspectj1.7\\lib\\aspectjweaver.jar Simple
execution(void Simple.count(int, int)) took 0ms
execution(void Simple.countFast(int)) took 4ms
execution(void Simple.count(int, int)) took 5021ms
execution(void Simple.countSlow(int)) took 5021ms
execution(void Simple.main(String[])) took 5030ms