Many versions of JDK: How do I specify which one is used?
问题 I have installed many versions of the JDK: 1.4.2, 1.5 and 1.6 . How do I specify which version of the JDK is used when compiling using Ant? 回答1: Two solutions: Specify the full path in your command: for example /opt/java/jdk16/bin/javac ... on Linux Use the -source and -target arguments of the javac command. This allows you specify the source code level and targeted JRE version Also note: Some Linux distributions can include tools to specify which JDK version to use by default. Using -source