f******e 发帖数: 582 | 1 I am using ubuntu and I try to compile a .java program which has generics,
like “Stack mydata”. When I compile, I got errors like
“generics are not supported..”
When I type “javac –version”, it has “javac 1.6.0_24”. Is this the new
version of javac?
I notice that openjdk-6-jak has been installed. Openjdk-7-jdk is available.
However, when I run “apt-get install openjdk-7-jdk”, it cannot find the
package.
What is wrong? Is it something wrong with my javac? Thanks a lot. |
e*****t 发帖数: 1005 | 2 I think so. Generics is added in java 5. So java 6 has it and if you don't
specify java source version, it should be 6 by default.
double check if you set the source level to be 1.4
new
.
【在 f******e 的大作中提到】 : I am using ubuntu and I try to compile a .java program which has generics, : like “Stack mydata”. When I compile, I got errors like : “generics are not supported..” : When I type “javac –version”, it has “javac 1.6.0_24”. Is this the new : version of javac? : I notice that openjdk-6-jak has been installed. Openjdk-7-jdk is available. : However, when I run “apt-get install openjdk-7-jdk”, it cannot find the : package. : What is wrong? Is it something wrong with my javac? Thanks a lot.
|
u****s 发帖数: 2186 | 3 exploit is right.
try
which -a javac
to see if any alias set for javac that has -source -target options set
【在 e*****t 的大作中提到】 : I think so. Generics is added in java 5. So java 6 has it and if you don't : specify java source version, it should be 6 by default. : double check if you set the source level to be 1.4 : : new : .
|
f*******n 发帖数: 12623 | 4 also, Stack is illegal. int is not a reference type. Only reference
types can go in < > |
b******y 发帖数: 9224 | 5 估计楼主的设置的路径不对?我一般在ubuntu下的.bashrc文件里这样设置path, 比如
说:
export PATH=/root/jdk1.6.0_22/bin:$PATH
export JAVA_HOME=/root/jdk1.6.0_22 |
f******e 发帖数: 582 | 6 Thanks for the reply.
I solved the problem, but I do not why. This is what I do: in the Makefile,
I remove the "-source 1.4" which is used by javac. Then the compile goes on
well.
what is the usage of "-source 1.4"? Thanks. |
T****U 发帖数: 3344 | 7 it forces compiler to user java 1.4 instead of current 1.6/1.7 version.
,
on
【在 f******e 的大作中提到】 : Thanks for the reply. : I solved the problem, but I do not why. This is what I do: in the Makefile, : I remove the "-source 1.4" which is used by javac. Then the compile goes on : well. : what is the usage of "-source 1.4"? Thanks.
|
e*****t 发帖数: 1005 | 8 makefile?
这个你还是得多看看java的基本东西。
,
on
【在 f******e 的大作中提到】 : Thanks for the reply. : I solved the problem, but I do not why. This is what I do: in the Makefile, : I remove the "-source 1.4" which is used by javac. Then the compile goes on : well. : what is the usage of "-source 1.4"? Thanks.
|