Eclipse 导入netty 示例程序

1. import - General - Projects from folder 

    选择源码程序,导入即可。

 

2. 此时的项目 Build path ->No action available 

    进入Navigator 视图, 修改 .project 

<natures>   
  <nature>org.eclipse.jdt.core.javanature</nature> 
</natures>  

    最好是复制一份新的项目的.project 文件 然后需要修改 name 标签内容即可

<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
	<name>netty-example-4.1.1.Final-sources</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>
	res>
</projectDescription>

 

3. 添加 jre 环境 及 netty jar包

    netty 包 就不多说了 

    jre : build - configure build path - libraries - add library - jre system library

 

4. 运行 项目中的main 方法 提示:无法加载主类

    io 包上 右键 build to path --> use as source folder 

    

    以下步骤看情况是否需要:

    查看 .classpath 文件中的内容是否正确

    
    源文件位置:src   

    核心包:con

    jar 位置:lib

    输出class位置:output
 

5. 添加项目后 Problems 里面 报错

    The project was not built since its build path is incomplete. Cannot find the class file for java.lang.Object. Fix the build path then try building this project

    The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files

    这个是 缺少 jre 环境 报的错, 在第四步 已经添加 这个错误会变成其他的错误 

    例如 netty example 会缺少 一下几种 jar 包

    barchat-udt-core --> The type com.barchart.udt.TypeUDT cannot be resolved

    protobuf-java

    slf4j-api 

    

转载于:https://my.oschina.net/grubby/blog/693284

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值