使用eclipse JDT compile class,解决 无法确定 X 的类型参数;对于上限为 X,java.lang.Object 的类型变量 X,不存在唯一最大实例
ant 命令行方式执行build javac编译class出现 泛型无法转换 无法确定 <X>X 的类型参数;对于上限为 X,java.lang.Object 的类型变量 X,不存在唯一最大实例
解决方法:
需要用到eclipse的jdt来编译class,不能再使用javac的默认编译方式。
在eclipse或MyEclipse的eclipse/plugin目录中找到org.eclipse.jdt.core_3.5.2.v_981_R35x.jar里面找到jdtCompilerAdapter.jar
还有
org.eclipse.jdt.compiler.tool_1.0.100.v_972_R35x.jar
org.eclipse.jdt.core_3.5.2.v_981_R35x.jar
org.eclipse.jdt.debug.ui_3.4.1.v20090811_r351.jar
jdtCompilerAdapter.jar并拷贝到ant_home/lib下。
在ant的build.xml脚本中加入
<property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/>
<javac nowarn="false" debug="true" debuglevel="source,lines,vars" destdir="${dist.path}/classes" source="1.6" target="1.6" encoding="utf-8" fork="true" memoryMaximumSize="512m" includeantruntime="false">
或者
<javac compiler="org.eclipse.jdt.core.JDTCompilerAdapter" nowarn="false" debug="true" debuglevel="source,lines,vars" destdir="${dist.path}/classes" source="1.6" target="1.6" encoding="utf-8" fork="true" memoryMaximumSize="512m" includeantruntime="false"/>
如果是用eclipse运行ant脚本,在右键菜单选择从RUN as Ant 启动build.xml时,在对话框中 选择Runtime jRE:run in the same JRE as workspace.
记得要引入上面需要的几个jar包
使用eclipse JDT compile class,解决 无法确定 X 的类型参数;对于上限为 X,java.lang.Object 的类型变量 X,不存在唯一最大实例的更多相关文章
- Spring MVC 解决 Could not write JSON: No serializer found for class java.lang.Object
Spring MVC 解决 Could not write JSON: No serializer found for class java.lang.Object 资料参考:http://stack ...
- 解决本机安装多版本jdk导致The type java.lang.Object cannot be resolved It is indirectly referenced ...
本机开始安装了jdk1.6,然后安装了jdk1.8 当在调自动化的时候,发现传入函数传参String类型,报错The type java.lang.Object cannot be resolved ...
- eclipse中java文件报错:The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files
问题:The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class fi ...
- 解决对含有第三方jar包的项目打包出现java.lang.NoClassDefFoundError问题
用eclipse普通的打包方式,对含有第三方jar包的项目进行打包.调用方法后一只出现java.lang.NoClassDefFoundError问题. 从网上搜寻,很多都是在MANIFEST.MF文 ...
- 解决:导入第三方jar包后,仍然出现java.lang.NoClassDefFoundError的错误
最近,在运行某个Android工程的时候,一直抛出java.lang.NoClassDefFoundError异常. 按照异常所给出的信息,应该是程序使用到的第三方jar包出了问题. 但是,这些第三方 ...
- 【MyBatis学习06】_parameter:解决There is no getter for property named in class java.lang.String
我们知道在mybatis的映射中传参数,只能传入一个.通过#{参数名} 即可获取传入的值. Mapper接口文件: public int delete(int id) throws Exception ...
- _parameter:解决There is no getter for property named in class java.lang.String
我们知道在mybatis的映射中传参数,只能传入一个.通过#{参数名} 即可获取传入的值. Mapper接口文件: public int delete(int id) throws Exception ...
- java出现The type java.lang.Object cannot be resolved. It is indirectly referenced.....解决办法
当你在Eclipse引用不同版本JDK工程时会发生该问题.由于你开发环境中应用了多个版 本的JDK 或JRE导致的.Eclipse会按照最初的开发环境默认选择对应的Jre.如Eclipse上有jdk1 ...
- 解决Spark用Maven编译时报Exception in thread "main" java.lang.OutOfMemoryError: PermGen space异常
异常截图: 解决方法: export MAVEN_OPTS="-Xmx2g -XX:MaxPermSize=512M -XX:ReservedCodeCacheSize=512m"
随机推荐
- iOS(OC)中的冒泡排序
NSMutableArray *array = [NSMutableArray arrayWithObjects:@"12",@"84", @"35& ...
- WebService 调用
一.WebService调用 1.webservice支持四种调用方式:SOAP 1.1,SOAP 1.2,GET,POST. 2.如果要webservice支持GET,POST调 ...
- MapReduce几个简单的例子
文件合并和去重: 可以把每一行文本作为key,value为随意值. 数字排序: MapReduce过程中就有排序,它是按照key值进行排序的,如果key为封装int的IntWritable类型,那么M ...
- Exception-异常
异常(Exception)是程序执行过程中所产生的问题 产生原因:用户输入无效数字.找不到需要打开的文件.在通讯中网络连接中断.JVM发生了内存溢出 异常的三个种类:检查异常.运行时异常.错误(类似异 ...
- LeetCode(76) Minimum Window Substring
题目 Given a string S and a string T, find the minimum window in S which will contain all the characte ...
- Yii中事件触发机制
控制器初始化中添加事件处理方法,在需要触发的地方直接触发 public function init() { parent::init(); // TODO: Change the autogenera ...
- 斯坦福第七课:正则化(Regularization)
7.1 过拟合的问题 7.2 代价函数 7.3 正则化线性回归 7.4 正则化的逻辑回归模型 7.1 过拟合的问题 如果我们有非常多的特征,我们通过学习得到的假设可能能够非常好地适应训练集( ...
- 从一个Fragment跳转到另一个Fragment
我们知道Activity之间的跳转可以使用 startActivity(intent).但Fragment之间的跳转却不能使用该方法,那该怎么办呢? 直接上代码: 核心代码 @Override//核心 ...
- wav文件格式分析(二)
(三)格式分析 WAVE文件是由若干个Chunk组成的.按照在文件中的出现位置包括:RIFF WAVE Chunk, Format Chunk, Fact Chunk(可选), Data Chunk. ...
- Lintcode 175 Invert Binary Tree
I did it in a recursive way. There is another iterative way to do it. I will come back at it later. ...
