I'm trying to compile the following java app: http://blogs.oracle.com/andreas/resource/InstallCert.java (as outlined here , but I get a few errors:
C:\foo>javac InstallCert.java
InstallCert.java:122: ';' expected
for (int b : bytes) {
^
InstallCert.java:129: illegal start of expression
}
^
2 errors
I am using version jdk 1.4.2_11
The first problem is that your java compiler does not recognize the class StringBuilder
. Since it is in the java.lang
package which does not need to be imported, the only explanation is that your JDK is Java 1.4 or older, since StringBuilder
was only introduced in Java 1.5
So you need to update your Java installation (or if you have multiple JDKs installed, make sure you use the right one).
Update: The new error is also caused by the old Java version, because the for-each loop syntax was only added in Java 1.5 as well. Update your JDK already. 1.4 is really, really old and should not be used anymore.
You need a newer Java compiler. That for statement will only compile in Java 5 or above.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.