s*******e 发帖数: 76 | 1 public class ReadCommand{
public static void main(String[] arg){
String s1=arg[1];
System.out.println(s1);
}
}
能COMPILE,但是一RUN就有问题,谢谢了 |
w*r 发帖数: 2421 | 2 it depends on what parameter(S) you send on command prompt
index out of range exception may happen if you only send 1 parameter
【在 s*******e 的大作中提到】 : public class ReadCommand{ : public static void main(String[] arg){ : String s1=arg[1]; : System.out.println(s1); : } : } : 能COMPILE,但是一RUN就有问题,谢谢了
|
s*******e 发帖数: 76 | 3 出来的是Exception in thread main java.lang.UnsupportedClassversionError:
sdk1.4就不会,到底为什么会这样,诡异
【在 w*r 的大作中提到】 : it depends on what parameter(S) you send on command prompt : index out of range exception may happen if you only send 1 parameter
|
t****5 发帖数: 20 | 4 apparently you compiled it with 1.5 javac,
but run it with 1.4 java.
try java -version
【在 s*******e 的大作中提到】 : 出来的是Exception in thread main java.lang.UnsupportedClassversionError: : sdk1.4就不会,到底为什么会这样,诡异
|
s*******e 发帖数: 76 | 5 thank you so much.
I just find out I made a stupid mistake
I installed Oracle on my laptop
the default Oracle path is for its jre1.3.0.
Thank you for your help
【在 t****5 的大作中提到】 : apparently you compiled it with 1.5 javac, : but run it with 1.4 java. : try java -version
|