i want to run this program using JDK1.3 . . . How to run this code by using Eclipse as i installed JDK1.7. In this program "assert" cannot be used as identifier from JDK1.4 onwards, as it is changed to KEYWORD. So, I want to run as Identifier by using JDK1.3. How to change JDKversion in Eclipse. Is it necessary to install JDK1.3?
public class A
{
public static void main(String[] args)
{
System.out.println(1);
int assert = 10;
System.out.println(2);
}
}
Try this:
Window
-> Preferences
. Java
-> Compiler
from the left panel. 1.3
as Compiler compliance level
. Apply
, then OK
. In Eclipse you can specify two things in the preferences :
the compilation class format (preferences/java/compiler : compiler compliance level)
the jdk used (preferences/java/installed jres)
You probably want to set both. But in order to set the JDK used, you must install the JDK1.3 (you can have as many jdk as you want on your PC).
Unzip JDK1.3 somewhere in your files, then go to Eclipse, menu Window --> preferences, and select Java --> Installed JREs in the menu on the left.
Choose button Add and then Standard VM. There you can set the location of the JDK1.3 to be used.
Then go to your project, right click, Properties, Java Compiler and JDK compliance to 1.3. In the same Project Properties menu, look for Java Build Path and, in the Libraries tab, change the JRE System Library (remove it and add another library - JRE System library -- select JDK1.3 taht you just added).
Done.
Yes, you need to install JDK 1.3 (Although you really need to think why would you and consider if it's better spending the time refactoring some codes and make it run on at least Java 6 and even better for Java 7), 1.3 is so old.
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.