--- old/src/share/classes/com/sun/tools/javac/main/Option.java 2013-01-18 02:48:38.787470859 -0500 +++ new/src/share/classes/com/sun/tools/javac/main/Option.java 2013-01-18 02:48:37.691409647 -0500 @@ -40,6 +40,7 @@ import com.sun.tools.javac.code.Lint; import com.sun.tools.javac.code.Source; import com.sun.tools.javac.code.Type; +import com.sun.tools.javac.jvm.Profile; import com.sun.tools.javac.jvm.Target; import com.sun.tools.javac.processing.JavacProcessingEnvironment; import com.sun.tools.javac.util.Log; @@ -215,6 +216,18 @@ return true; } return super.process(helper, option, operand); + } + }, + + PROFILE("-profile", "opt.arg.profile", "opt.profile", STANDARD, BASIC) { + @Override + public boolean process(OptionHelper helper, String option, String operand) { + Profile profile = Profile.lookup(operand); + if (profile == null) { + helper.error("err.invalid.profile", operand); + return true; + } + return super.process(helper, option, operand); } },