java project 转换为 aspectj project

首先要在eclipse中装Aspectj插件。根据不同的eclipse版本到eclipse官方网站上下载,或者直接在eclipse中更新安装 
 

在当前项目中找到.project文件

如下

<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
	<name>toolBar</name>
	<comment></comment>
	<projects>
	</projects>
	<buildSpec>
		<buildCommand>
			<name>org.eclipse.jdt.core.javabuilder</name>
			<arguments>
			</arguments>
		</buildCommand>
	</buildSpec>
	<natures>
		<nature>org.eclipse.jdt.core.javanature</nature>
	</natures>
</projectDescription>

改为

<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
	<name>toolBar</name>
	<comment></comment>
	<projects>
	</projects>
	<buildSpec>
		<buildCommand>
			<name>org.eclipse.ajdt.core.ajbuilder</name>
			<arguments>
			</arguments>
		</buildCommand>
	</buildSpec>
	<natures>
		<nature>org.eclipse.ajdt.ui.ajnature</nature>
		<nature>org.eclipse.jdt.core.javanature</nature>
	</natures>
</projectDescription>

同时还需修改.classpath文件

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
	<classpathentry kind="src" path="src"/>
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
	<classpathentry kind="lib" path="./lib/jl1.0.jar"/>
	<classpathentry kind="lib" path="./lib/mp3spi1.9.4.jar"/>
	<classpathentry kind="lib" path="./lib/tritonus_share.jar"/>
	<classpathentry kind="output" path="bin"/>
</classpath>

在其中添加一项
<classpathentry kind="con" path="org.eclipse.ajdt.core.ASPECTJRT_CONTAINER"/>

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
	<classpathentry kind="src" path="src"/>
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
	<classpathentry kind="con" path="org.eclipse.ajdt.core.ASPECTJRT_CONTAINER"/>
	<classpathentry kind="lib" path="./lib/jl1.0.jar"/>
	<classpathentry kind="lib" path="./lib/mp3spi1.9.4.jar"/>
	<classpathentry kind="lib" path="./lib/tritonus_share.jar"/>
	<classpathentry kind="output" path="bin"/>
</classpath>

然后刷新工程,就可以看到标识有J变味了AJ,说明OK了

你可能感兴趣的:(java,eclipse,Path,encoding,output)