由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Java版 - 请帮忙看看这个编译错误
相关主题
也问一个Eclipse的问题大侠帮忙看看这个code为什么在jdk1。5下面不能运行
help "java.lang.NoSuchMethodError"这段程序的输出是什么? 为什么
Java练习题 12Re: 怎样不用main(String args[])输出"hello worl
ant javac error in eclipse 3.0?interesting
It's a Java Bug请教大家:如何modify java code in order to compile
Eclipse编译老是出问题啊。。file not found exceptionHow big is the penalty for compile with debugging mode on?
com.sun.tools.javac.Main 问题Java on AIX
再问generic问题:tomcat编译错误请问一个最初级问题
相关话题的讨论汇总
话题: syntax话题: string话题: list话题: 编译话题: eclipse
进入Java版参与讨论
1 (共1页)
T*****e
发帖数: 361
1
代码如下:
import java.util.*;
public class test {
public static void main(String[] args) {
List list = new ArrayList( 100 );
for( int i = 0; i < 10; i ++ ){
list.add( i, String.valueOf( i*31 % 20 ) );
}
Collections.sort( list );
System.out.println( list );
}
}
编译错误:(jdk 1.5.0_01)
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
Syntax error on token "<", invalid AssignmentOperator
Syntax error on token "=", != expected
Syntax
m******t
发帖数: 2416
2

Are you sure you are running a 1.5 javac? From
the same command line where you got the error, run "javac -version".

【在 T*****e 的大作中提到】
: 代码如下:
: import java.util.*;
: public class test {
: public static void main(String[] args) {
: List list = new ArrayList( 100 );
: for( int i = 0; i < 10; i ++ ){
: list.add( i, String.valueOf( i*31 % 20 ) );
: }
: Collections.sort( list );
: System.out.println( list );

T*****e
发帖数: 361
3
Yes, I am sure. I am using eclipse 3.0.2.
There is no other versions of java installed in my pc except jdk/jre 1.5.0_01.

【在 m******t 的大作中提到】
:
: Are you sure you are running a 1.5 javac? From
: the same command line where you got the error, run "javac -version".

T*****e
发帖数: 361
4
刚刚把jdk/jre1.5.0_01删除了,安装了jdk/jre1.5.0_02。
问题还是一样。
看了看eclipse/windows/preferences/java/installed jres,
只有我新安装的jdk1.5.0_02.
可是当我直接用命令行来编译运行这个class时都没有问题。
是不是eclipse并不是用jdk1.5.0_02在编译啊?
头疼……

【在 T*****e 的大作中提到】
: 代码如下:
: import java.util.*;
: public class test {
: public static void main(String[] args) {
: List list = new ArrayList( 100 );
: for( int i = 0; i < 10; i ++ ){
: list.add( i, String.valueOf( i*31 % 20 ) );
: }
: Collections.sort( list );
: System.out.println( list );

u****s
发帖数: 2186
5
Eclipse 3.0.2 doesn't support JDK1.5, you need to install a plugin
or get 3.1M6
goto Project/Properties/Compliance
set the compile level to 1.5

【在 T*****e 的大作中提到】
: Yes, I am sure. I am using eclipse 3.0.2.
: There is no other versions of java installed in my pc except jdk/jre 1.5.0_01.

T*****e
发帖数: 361
6
Thanks a lot. I got eclipse 3.1m6 and now the errors are gone. :)

【在 u****s 的大作中提到】
: Eclipse 3.0.2 doesn't support JDK1.5, you need to install a plugin
: or get 3.1M6
: goto Project/Properties/Compliance
: set the compile level to 1.5

T*****e
发帖数: 361
7
安装了eclipse 3.1m6,现在编译没有问题了。多谢!
对了,tomcat5.5.7没法编译generic code,有什么办法么?再谢!

1.5.0_01.

【在 u****s 的大作中提到】
: Eclipse 3.0.2 doesn't support JDK1.5, you need to install a plugin
: or get 3.1M6
: goto Project/Properties/Compliance
: set the compile level to 1.5

1 (共1页)
进入Java版参与讨论
相关主题
请问一个最初级问题It's a Java Bug
scala - I 服了 UEclipse编译老是出问题啊。。file not found exception
问一个 java generic问题com.sun.tools.javac.Main 问题
java这个是什么逻辑?再问generic问题:tomcat编译错误
也问一个Eclipse的问题大侠帮忙看看这个code为什么在jdk1。5下面不能运行
help "java.lang.NoSuchMethodError"这段程序的输出是什么? 为什么
Java练习题 12Re: 怎样不用main(String args[])输出"hello worl
ant javac error in eclipse 3.0?interesting
相关话题的讨论汇总
话题: syntax话题: string话题: list话题: 编译话题: eclipse