changeset 6588:c933505d75c2 jdk8-b79

Merge
author dcherepanov
date Tue, 26 Feb 2013 12:54:39 +0400
parents 5245b2f1c53d (current diff) bb97c93e4fd7 (diff)
children d967dd39a5ca 8d3dbb724859
files
diffstat 49 files changed, 4061 insertions(+), 160 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Thu Feb 21 17:55:33 2013 -0800
+++ b/.hgtags	Tue Feb 26 12:54:39 2013 +0400
@@ -199,3 +199,4 @@
 4a67fdb752b7d6329d9be9c28d3f9d6cf7eb9a3c jdk8-b75
 3a263052866137b645ab86498a43693ff5c19e69 jdk8-b76
 b2fc8e31cecc35b76188e821d4c5dc0e0b74ac24 jdk8-b77
+00b7535d743f83eda763c10b3c9ea19ba4b67f55 jdk8-b78
--- a/make/common/Defs-macosx.gmk	Thu Feb 21 17:55:33 2013 -0800
+++ b/make/common/Defs-macosx.gmk	Tue Feb 26 12:54:39 2013 +0400
@@ -405,3 +405,11 @@
 endif
 
 LIB_LOCATION ?= $(LIBDIR)
+
+# Adding these macros will make it an error to link to mac APIs newer than OS version 10.7
+ifeq ($(MACOSX_REQUIRED_VERSION),)
+  MACOSX_REQUIRED_VERSION:=1070
+endif
+MACOSX_OS_VERSION_CFLAGS := -DMAC_OS_X_VERSION_MAX_ALLOWED=$(MACOSX_REQUIRED_VERSION) -DMAC_OS_X_VERSION_MIN_REQUIRED=$(MACOSX_REQUIRED_VERSION)
+OTHER_CFLAGS += $(MACOSX_OS_VERSION_CFLAGS)
+OTHER_CXXFLAGS += $(MACOSX_OS_VERSION_CFLAGS)
--- a/make/common/Release.gmk	Thu Feb 21 17:55:33 2013 -0800
+++ b/make/common/Release.gmk	Tue Feb 26 12:54:39 2013 +0400
@@ -1056,6 +1056,7 @@
 	    -processor com.sun.tools.javac.sym.CreateSymbols \
 	    -Acom.sun.tools.javac.sym.Jar=$(RT_JAR) \
 	    -Acom.sun.tools.javac.sym.Dest=$(OUTPUTDIR)/symbols/META-INF/sym/rt.jar \
+	    -Acom.sun.tools.javac.sym.Profiles=$(JDK_TOPDIR)/makefiles/profile-rtjar-includes.txt \
 	    $(CORE_PKGS) $(NON_CORE_PKGS) $(EXCLUDE_PROPWARN_PKGS) $(EXPORTED_PRIVATE_PKGS)
 	$(BOOT_JAR_CMD) $(CREATE_JAR_OPTS_NOMANIFEST) $(LIBDIR)/ct.sym \
 	    -C $(OUTPUTDIR)/symbols META-INF $(BOOT_JAR_JFLAGS)
--- a/make/docs/Makefile	Thu Feb 21 17:55:33 2013 -0800
+++ b/make/docs/Makefile	Tue Feb 26 12:54:39 2013 +0400
@@ -1,4 +1,4 @@
-# Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -208,6 +208,7 @@
                 -use					\
                 -keywords				\
 		-Xdoclint:none				\
+                -Xprofilespath $(JDK_TOPDIR)/makefiles/profile-rtjar-includes.txt \
 		$(ADDITIONAL_JAVADOCFLAGS)
 
 ifdef OPENJDK
--- a/make/java/version/Makefile	Thu Feb 21 17:55:33 2013 -0800
+++ b/make/java/version/Makefile	Tue Feb 26 12:54:39 2013 +0400
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -40,6 +40,7 @@
 	    -e 's/@@java_version@@/$(RELEASE)/g' \
 	    -e 's/@@java_runtime_version@@/$(FULL_VERSION)/g' \
 	    -e 's/@@java_runtime_name@@/$(RUNTIME_NAME)/g' \
+	    -e 's/@@java_profile_name@@//g' \
 	$< > $@.temp
 	@$(MV) $@.temp $@
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/tools/src/build/tools/classfile/RemoveMethods.java	Tue Feb 26 12:54:39 2013 +0400
@@ -0,0 +1,115 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package build.tools.classfile;
+
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.Set;
+import java.util.HashSet;
+
+import com.sun.tools.classfile.AccessFlags;
+import com.sun.tools.classfile.Attributes;
+import com.sun.tools.classfile.ClassFile;
+import com.sun.tools.classfile.ClassWriter;
+import com.sun.tools.classfile.ConstantPool;
+import com.sun.tools.classfile.Field;
+import com.sun.tools.classfile.Method;
+
+public class RemoveMethods {
+
+    public static void main(String[] args) throws Exception {
+        if (args.length < 2) {
+            System.err.println("Usage: java RemoveMethods classfile output [method...]");
+            System.exit(-1);
+        }
+
+        // class file to read
+        Path input = Paths.get(args[0]);
+
+        // class file to write, if directory then use the name of the input
+        Path output = Paths.get(args[1]);
+        if (Files.isDirectory(output))
+            output = output.resolve(input.getFileName());
+
+        // the methods to remove
+        Set<String> methodsToRemove = new HashSet<>();
+        int i = 2;
+        while (i < args.length)
+            methodsToRemove.add(args[i++]);
+
+        // read class file
+        ClassFile cf;
+        try (InputStream in = Files.newInputStream(input)) {
+             cf = ClassFile.read(in);
+        }
+
+        final int magic = cf.magic;
+        final int major_version = cf.major_version;
+        final int minor_version = cf.minor_version;
+        final ConstantPool cp = cf.constant_pool;
+        final AccessFlags access_flags = cf.access_flags;
+        final int this_class = cf.this_class;
+        final int super_class = cf.super_class;
+        final int[] interfaces = cf.interfaces;
+        final Field[] fields = cf.fields;
+        final Attributes class_attrs = cf.attributes;
+
+        // remove the requested methods, no signature check at this time
+        Method[] methods = cf.methods;
+        i = 0;
+        while (i < methods.length) {
+            Method m = methods[i];
+            String name = m.getName(cp);
+            if (methodsToRemove.contains(name)) {
+                int len = methods.length;
+                Method[] newMethods = new Method[len-1];
+                if (i > 0)
+                    System.arraycopy(methods, 0, newMethods, 0, i);
+                int after = methods.length - i - 1;
+                if (after > 0)
+                    System.arraycopy(methods, i+1, newMethods, i, after);
+                methods = newMethods;
+                String paramTypes = m.descriptor.getParameterTypes(cp);
+                System.out.format("Removed method %s%s from %s%n",
+                    name, paramTypes, cf.getName());
+                continue;
+            }
+            i++;
+        }
+
+        // TBD, prune constant pool of entries that are no longer referenced
+
+        // re-write class file
+        cf = new ClassFile(magic, minor_version, major_version, cp, access_flags,
+                this_class, super_class, interfaces, fields, methods, class_attrs);
+        try (OutputStream out = Files.newOutputStream(output)) {
+             new ClassWriter().write(cf, out);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/tools/src/build/tools/deps/CheckDeps.java	Tue Feb 26 12:54:39 2013 +0400
@@ -0,0 +1,226 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package build.tools.deps;
+
+import java.nio.file.DirectoryStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.charset.StandardCharsets;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Enumeration;
+import java.util.Properties;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.URL;
+
+import com.sun.tools.classfile.ClassFile;
+import com.sun.tools.classfile.Dependencies;
+import com.sun.tools.classfile.Dependency;
+
+/**
+ * A simple tool to check the JAR files in a JRE image to ensure that there
+ * aren't any references to types that do not exist. The tool is intended to
+ * be used in the JDK "profiles" build to help ensure that the profile
+ * definitions are kept up to date.
+ */
+
+public class CheckDeps {
+
+    // classfile API for finding dependencies
+    static final Dependency.Finder finder = Dependencies.getClassDependencyFinder();
+
+    // "known types", found in rt.jar or other JAR files
+    static final Set<String> knownTypes = new HashSet<>();
+
+    // References to unknown types. The map key is the unknown type, the
+    // map value is the set of classes that reference it.
+    static final Map<String,Set<String>> unknownRefs = new HashMap<>();
+
+    // The property name is the name of an unknown type that is allowed to be
+    // references. The property value is a comma separated list of the types
+    // that are allowed to reference it. The list also includes the names of
+    // the profiles that the reference is allowed.
+    static final Properties allowedBadRefs = new Properties();
+
+    /**
+     * Returns the class name for the given class file. In the case of inner
+     * classes then the enclosing class is returned in order to keep the
+     * rules simple.
+     */
+    static String toClassName(String s) {
+        int i = s.indexOf('$');
+        if (i > 0)
+            s = s.substring(0, i);
+        return s.replace("/", ".");
+    }
+
+    /**
+     * Analyze the dependencies of all classes in the given JAR file. The
+     * method updates knownTypes and unknownRefs as part of the analysis.
+     */
+    static void analyzeDependencies(Path jarpath) throws Exception {
+        System.out.format("Analyzing %s%n", jarpath);
+        try (JarFile jf = new JarFile(jarpath.toFile())) {
+            Enumeration<JarEntry> entries = jf.entries();
+            while (entries.hasMoreElements()) {
+                JarEntry e = entries.nextElement();
+                String name = e.getName();
+                if (name.endsWith(".class")) {
+                    ClassFile cf = ClassFile.read(jf.getInputStream(e));
+                    for (Dependency d : finder.findDependencies(cf)) {
+                        String origin = toClassName(d.getOrigin().getName());
+                        String target = toClassName(d.getTarget().getName());
+
+                        // origin is now known
+                        unknownRefs.remove(origin);
+                        knownTypes.add(origin);
+
+                        // if the target is not known then record the reference
+                        if (!knownTypes.contains(target)) {
+                            Set<String> refs = unknownRefs.get(target);
+                            if (refs == null) {
+                                // first time seeing this unknown type
+                                refs = new HashSet<>();
+                                unknownRefs.put(target, refs);
+                            }
+                            refs.add(origin);
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+    /**
+     * We have closure (no references to types that do not exist) if
+     * unknownRefs is empty. When unknownRefs is not empty then it should
+     * only contain references that are allowed to be present (these are
+     * loaded from the refs.allowed properties file).
+     *
+     * @param the profile that is being tested, this determines the exceptions
+     *   in {@code allowedBadRefs} that apply.
+     *
+     * @return {@code true} if there are no missing types or the only references
+     *   to missing types are described by {@code allowedBadRefs}.
+     */
+    static boolean checkClosure(String profile) {
+        // process the references to types that do not exist.
+        boolean fail = false;
+        for (Map.Entry<String,Set<String>> entry: unknownRefs.entrySet()) {
+            String target = entry.getKey();
+            for (String origin: entry.getValue()) {
+                // check if origin -> target allowed
+                String value = allowedBadRefs.getProperty(target);
+                if (value == null) {
+                    System.err.format("%s -> %s (unknown type)%n", origin, target);
+                    fail = true;
+                } else {
+                    // target is known, check if the origin is one that we
+                    // expect and that the exception applies to the profile.
+                    boolean found = false;
+                    boolean applicable = false;
+                    for (String s: value.split(",")) {
+                        s = s.trim();
+                        if (s.equals(origin))
+                            found = true;
+                        if (s.equals(profile))
+                            applicable = true;
+                    }
+                    if (!found || !applicable) {
+                        if (!found) {
+                            System.err.format("%s -> %s (not allowed)%n", origin, target);
+                        } else {
+                            System.err.format("%s -> %s (reference not applicable to %s)%n",
+                                origin, target, profile);
+                        }
+                        fail = true;
+                    }
+                }
+
+            }
+        }
+
+        return !fail;
+    }
+
+    static void fail(URL url) throws Exception {
+        System.err.println("One or more unexpected references encountered");
+        if (url != null)
+            System.err.format("Check %s is up to date%n", Paths.get(url.toURI()));
+        System.exit(-1);
+    }
+
+    public static void main(String[] args) throws Exception {
+        // load properties file so that we know what missing types that are
+        // allowed to be referenced.
+        URL url = CheckDeps.class.getResource("refs.allowed");
+        if (url != null) {
+            try (InputStream in = url.openStream()) {
+                allowedBadRefs.load(new InputStreamReader(in, StandardCharsets.UTF_8));
+            }
+        }
+
+        if (args.length != 2) {
+            System.err.println("Usage: java CheckDeps <image> <profile>");
+            System.exit(-1);
+        }
+
+        String image = args[0];
+        String profile = args[1];
+
+        // process JAR files on boot class path
+        Path lib = Paths.get(image, "lib");
+        try (DirectoryStream<Path> stream = Files.newDirectoryStream(lib, "*.jar")) {
+            for (Path jarpath: stream) {
+                analyzeDependencies(jarpath);
+            }
+        }
+
+        // classes on boot class path should not reference other types
+        boolean okay = checkClosure(profile);
+        if (!okay)
+            fail(url);
+
+        // process JAR files in the extensions directory
+        try (DirectoryStream<Path> stream = Files.newDirectoryStream(lib.resolve("ext"), "*.jar")) {
+            for (Path jarpath: stream) {
+                analyzeDependencies(jarpath);
+            }
+        }
+
+        // re-check to ensure that the extensions doesn't reference types that
+        // do not exist.
+        okay = checkClosure(profile);
+        if (!okay)
+            fail(url);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/tools/src/build/tools/deps/refs.allowed	Tue Feb 26 12:54:39 2013 +0400
@@ -0,0 +1,40 @@
+#
+# This properties-formatted file contains the names of the non-existent types
+# that are allowed to be referenced from classes in a profiles image.
+#
+# The property key is a type that does not exist. The property value is one or
+# more types that reference the missing type. The property value also encodes
+# the names of the profiles where this reference is allowed.
+
+# jsse.jar is not subsetted by the profiles build. For compact1 and compact2
+# then this means that there are references to Kerberos types that do not
+# exist. These references are harmless.
+#
+javax.security.auth.kerberos.KerberosKey=sun.security.ssl.krb5.KerberosClientKeyExchangeImpl,sun.security.ssl.krb5.Krb5ProxyImpl,compact1,compact2
+javax.security.auth.kerberos.KerberosPrincipal=sun.security.ssl.krb5.KerberosClientKeyExchangeImpl,sun.security.ssl.krb5.Krb5ProxyImpl,compact1,compact2
+javax.security.auth.kerberos.KerberosTicket=sun.security.ssl.krb5.KerberosClientKeyExchangeImpl,sun.security.ssl.krb5.KerberosClientKeyExchangeImpl,compact1,compact2
+javax.security.auth.kerberos.ServicePermission=sun.security.ssl.krb5.KerberosClientKeyExchangeImpl,sun.security.ssl.krb5.Krb5ProxyImpl,compact1,compact2
+sun.security.jgss.GSSCaller=sun.security.ssl.krb5.KerberosClientKeyExchangeImpl,sun.security.ssl.krb5.Krb5ProxyImpl,compact1,compact2
+sun.security.jgss.krb5.Krb5Util=sun.security.ssl.krb5.KerberosClientKeyExchangeImpl,sun.security.ssl.krb5.Krb5ProxyImpl,compact1,compact2
+sun.security.jgss.krb5.ServiceCreds=sun.security.ssl.krb5.Krb5ProxyImpl,compact1,compact2
+sun.security.krb5.EncryptedData= sun.security.ssl.krb5.KerberosPreMasterSecret,sun.security.ssl.krb5.KerberosClientKeyExchangeImpl,compact1,compact2
+sun.security.krb5.EncryptionKey=sun.security.ssl.krb5.KerberosPreMasterSecret,sun.security.ssl.krb5.KerberosClientKeyExchangeImpl,compact1,compact2
+sun.security.krb5.internal.crypto.KeyUsage=sun.security.ssl.krb5.KerberosPreMasterSecret,sun.security.ssl.krb5.KerberosClientKeyExchangeImpl,compact1,compact2
+sun.security.krb5.internal.EncTicketPart=sun.security.ssl.krb5.KerberosClientKeyExchangeImpl,compact1,compact2
+sun.security.krb5.internal.Krb5=sun.security.ssl.krb5.KerberosClientKeyExchangeImpl,compact1,compact2
+sun.security.krb5.internal.Ticket=sun.security.ssl.krb5.KerberosClientKeyExchangeImpl,compact1,compact2
+sun.security.krb5.KrbException=sun.security.ssl.krb5.KerberosPreMasterSecret,sun.security.ssl.krb5.KerberosClientKeyExchangeImpl,compact1,compact2
+sun.security.krb5.PrincipalName=sun.security.ssl.krb5.Krb5ProxyImpl,sun.security.ssl.krb5.KerberosClientKeyExchangeImpl,compact1,compact2
+sun.security.krb5.Realm=sun.security.ssl.krb5.KerberosClientKeyExchangeImpl,compact1,compact2
+
+# Residual references to java.beans.
+# The RemoveMethods tool does not yet purge the constant pool.
+# Rhino is due to be replaced so not worth addressing this dependency now.
+#
+java.beans.PropertyChangeListener=java.util.logging.LogManager,sun.org.mozilla.javascript.internal.Context,compact1,compact2,compact3
+java.beans.PropertyChangeEvent=sun.org.mozilla.javascript.internal.Context,compact3
+
+# JFR traces even in builds with JFR disabled
+com.oracle.jrockit.jfr.FlightRecorder: com.sun.management.MissionControl, compact3
+com.oracle.jrockit.jfr.management.FlightRecorderMBean: com.sun.management.MissionControl, compact3
+
--- a/make/tools/src/build/tools/jarreorder/JarReorder.java	Thu Feb 21 17:55:33 2013 -0800
+++ b/make/tools/src/build/tools/jarreorder/JarReorder.java	Tue Feb 26 12:54:39 2013 +0400
@@ -162,8 +162,9 @@
         for (int i = orderList.size() - 1; i >= 0; --i) {
             String s = orderList.get(i);
             if (allFilesExcluded.contains(s)) {
-                System.err.println("Included order file " + s
-                    + " is also excluded, skipping.");
+                // Disable this warning until 8005688 is fixed
+                // System.err.println("Included order file " + s
+                //    + " is also excluded, skipping.");
             } else if (new File(s).exists()) {
                 allFiles.add(s);
             } else {
--- a/makefiles/BuildJdk.gmk	Thu Feb 21 17:55:33 2013 -0800
+++ b/makefiles/BuildJdk.gmk	Tue Feb 26 12:54:39 2013 +0400
@@ -39,6 +39,12 @@
 # Setup the java compilers for the JDK build.
 include Setup.gmk
 
+# Include Profile information
+include ProfileNames.gmk
+
+# Include the corresponding custom file, if present.
+-include $(CUSTOM_MAKE_DIR)/BuildJdk.gmk
+
 import: import-only
 import-only:
 #       Import (corba jaxp jaxws langtools hotspot)
@@ -85,10 +91,11 @@
 	+$(MAKE) -f CopySamples.gmk
 
 # Create the final jdk and jre images, to be wrapped up
-# into packages, or installed.
+# into packages, or installed. Ensure PROFILE is not set
+# in these cases.
 images:
-	+$(MAKE) -f CreateJars.gmk
-	+$(MAKE) -f Images.gmk
+	+$(MAKE) PROFILE="" -f CreateJars.gmk
+	+$(MAKE) PROFILE="" -f Images.gmk
 ifeq ($(OPENJDK_TARGET_OS), macosx)
 	+$(MAKE) -f Bundles.gmk
 endif
@@ -97,6 +104,13 @@
 	+$(MAKE) -f CompileLaunchers.gmk OVERLAY_IMAGES=true
 	+$(MAKE) -f Images.gmk overlay-images
 
+# Create Compact Profile images
+$(ALL_PROFILES):
+	+$(MAKE) PROFILE=$@ -f CreateJars.gmk
+	+$(MAKE) PROFILE=$@ JRE_IMAGE_DIR=$(IMAGES_OUTPUTDIR)/j2re-$(word $(call profile_number,$@),$(PROFILE_NAMES))-image -f Images.gmk profile-image
+
+profiles: $(ALL_PROFILES)
+
 sign-jars:
 	+$(MAKE) -f SignJars.gmk
 
@@ -121,3 +135,4 @@
 .PHONY: import gensrc gendata classes libs launchers genclasses
 .PHONY: import-only gensrc-only gendata-only classes-only libs-only launchers-only genclasses-only
 .PHONY: all jdk demos images overlay-images bundles install
+.PHONY: profiles $(ALL_PROFILES)
--- a/makefiles/CompileDemos.gmk	Thu Feb 21 17:55:33 2013 -0800
+++ b/makefiles/CompileDemos.gmk	Tue Feb 26 12:54:39 2013 +0400
@@ -421,6 +421,7 @@
 		CFLAGS:=$(CFLAGS_JDKLIB) $(SHARED_LIBRARY_FLAGS) \
                         -I$(JDK_OUTPUTDIR)/democlasses/jni/Poller, \
 		LDFLAGS:=$(LDFLAGS_JDKLIB), \
+		LDFLAGS_SUFFIX_solaris:=-lc,\
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/demoobjs/jni/Poller,\
                 OUTPUT_DIR:=$(JDK_OUTPUTDIR)/demoobjs, \
 		LIBRARY:=Poller))
--- a/makefiles/CompileNativeLibraries.gmk	Thu Feb 21 17:55:33 2013 -0800
+++ b/makefiles/CompileNativeLibraries.gmk	Tue Feb 26 12:54:39 2013 +0400
@@ -2188,6 +2188,7 @@
 		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libjfr/mapfile-vers, \
 		LDFLAGS:=$(LDFLAGS_JDKLIB) \
 			 $(call SET_SHARED_LIBRARY_ORIGIN),\
+		LDFLAGS_SUFFIX_solaris:=-lc,\
 		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/windows/resource/version.rc,\
 		RC_FLAGS:=$(RC_FLAGS)\
 			  -D "JDK_FNAME=jfr.dll" \
@@ -2236,6 +2237,7 @@
 		LDFLAGS:=$(LDFLAGS_JDKLIB) \
 			 $(call SET_SHARED_LIBRARY_ORIGIN),\
 		LDFLAGS_SUFFIX_linux:=-lc -lpthread,\
+		LDFLAGS_SUFFIX_solaris:=-lc,\
 		LDFLAGS_SUFFIX_windows:=$(WIN_JAVA_LIB) advapi32.lib user32.lib version.lib, \
 		LDFLAGS_SUFFIX_posix:=-lm -ljava -ljvm,\
 		VERSIONINFO_RESOURCE:=$(JDK_TOPDIR)/src/closed/share/native/sun/java2d/cmm/kcms/cmm.rc,\
@@ -2939,6 +2941,7 @@
 		MAPFILE:=$(JDK_TOPDIR)/makefiles/mapfiles/libj2ucrypto/mapfile-vers, \
 		LDFLAGS:=$(LDFLAGS_JDKLIB),\
 		LDFLAGS_SUFFIX:=$(LIBDL),\
+		LDFLAGS_SUFFIX_solaris:=-lc,\
 		OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libj2ucrypto))
 
 $(BUILD_LIBJ2UCRYPTO) : $(BUILD_LIBJAVA)
--- a/makefiles/CreateJars.gmk	Thu Feb 21 17:55:33 2013 -0800
+++ b/makefiles/CreateJars.gmk	Tue Feb 26 12:54:39 2013 +0400
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -35,16 +35,19 @@
 
 include Tools.gmk
 
+include Profiles.gmk
+
 #
 # This makefile...so that altering will trigger rebuilding include/exclude-lists => jars
 #
 MAKEFILE=$(JDK_TOPDIR)/makefiles/CreateJars.gmk
+#
+# And similarly for the Profiles
+PROFILE_MAKEFILES=$(JDK_TOPDIR)/makefiles/Profiles.gmk $(JDK_TOPDIR)/makefiles/profile-rtjar-includes.txt
 
 MAINMANIFEST := $(JDK_TOPDIR)/make/tools/manifest.mf
 BEANMANIFEST := $(JDK_TOPDIR)/make/javax/swing/beaninfo/manifest
 
-JARS:=
-
 $(eval $(call MakeDir,$(IMAGES_OUTPUTDIR)/lib))
 
 ##########################################################################################
@@ -57,7 +60,6 @@
 		JAR:=$(IMAGES_OUTPUTDIR)/lib/jconsole.jar,\
 		SKIP_METAINF:=true))
 
-JARS+=$(IMAGES_OUTPUTDIR)/lib/jconsole.jar
 
 ##########################################################################################
 
@@ -68,7 +70,6 @@
 		JAR:=$(IMAGES_OUTPUTDIR)/lib/ext/dnsns.jar,\
 		SKIP_METAINF:=true))
 
-JARS+=$(IMAGES_OUTPUTDIR)/lib/ext/dnsns.jar
 
 ##########################################################################################
 
@@ -127,15 +128,20 @@
 		JAR:=$(IMAGES_OUTPUTDIR)/lib/ext/localedata.jar,\
 		SKIP_METAINF:=true))
 
-JARS+=$(IMAGES_OUTPUTDIR)/lib/ext/localedata.jar
-
 ##########################################################################################
-# rt.jar and resources.jar are being built in the same way as in the old build. They require
-# the files to be in a certain order and converting that is not easy and will not be needed
-# in jigsaw anyway.
+#
+# Different variants of rt.jar are built based on the current profile. The output
+# directory is augmented with the profile name so that the final jar file and all the
+# intermediary list files will be in directory. This has the form lib$PROFILE rather than
+# lib/$PROFILE so that it won't get copied as part of the image generation process.
+# Each profile customizes the RT_JAR_EXCLUDES variable.
+#
+##########################################################################################
 
-# Exclude list for rt.jar and resources.jar
-RT_JAR_EXCLUDES := \
+# Full JRE exclude list for rt.jar and resources.jar
+# This value should exclude types destined for jars other than rt.jar and resources.jar. 
+# When building a Profile this value augments the profile specific exclusions
+RT_JAR_EXCLUDES += \
 	com/oracle/security \
 	com/sun/codemodel \
 	com/sun/crypto/provider \
@@ -258,24 +264,9 @@
 	sun/tools/util \
 	sun/util/cldr/CLDRLocaleDataMetaInfo.class \
 	sun/util/resources/cldr \
-	$(LOCALEDATA_INCLUDES)
-
-# These files should never be put into rt.jar
-# but due to a misstake...some are put there if embedded
-#
-ifneq ($(JAVASE_EMBEDDED), true)
-# normal (correct) case
-RT_JAR_EXCLUDES += \
+	$(LOCALEDATA_INCLUDES) \
 	com/oracle/jrockit/jfr \
 	oracle/jrockit/jfr
-else
-# embedded (broken) case
-RT_JAR_EXCLUDES += \
-  oracle/jrockit/jfr/parser \
-  oracle/jrockit/jfr/tools \
-  oracle/jrockit/jfr/NativeOptions.class \
-  oracle/jrockit/jfr/RepositoryChunkHandler.class
-endif
 
 ifeq ($(OPENJDK_TARGET_OS), macosx)
         RT_JAR_EXCLUDES += com/sun/nio/sctp \
@@ -286,8 +277,8 @@
 ALL_FILES_IN_CLASSES := $(call not-containing,_the.,$(filter-out %javac_state,\
                         $(call CacheFind,$(JDK_OUTPUTDIR)/classes)))
 
-RT_JAR_MANIFEST_FILE := $(IMAGES_OUTPUTDIR)/lib/_the.rt.jar_manifest
-RESOURCE_JAR_MANIFEST_FILE := $(IMAGES_OUTPUTDIR)/lib/_the.resources.jar_manifest
+RT_JAR_MANIFEST_FILE := $(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.rt.jar_manifest
+RESOURCE_JAR_MANIFEST_FILE := $(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.resources.jar_manifest
 
 $(RT_JAR_MANIFEST_FILE): $(MAINMANIFEST) $(BEANMANIFEST)
 	$(MKDIR) -p $(@D)
@@ -307,7 +298,7 @@
 	       $(MAINMANIFEST) >> $@.tmp
 	$(MV) $@.tmp $@
 
-$(IMAGES_OUTPUTDIR)/lib/_the.jars.exclude: $(MAKEFILE)
+$(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.jars.exclude: $(MAKEFILE) $(PROFILE_MAKEFILES)
 	$(MKDIR) -p $(@D)
 	$(RM) $@ $@.tmp
 	$(call ListPathsSafely,RT_JAR_EXCLUDES,\n, >> $@.tmp)
@@ -320,55 +311,115 @@
 	$(TOOL_ADDJSUM) $< $@.tmp
 	$(MV) $@.tmp $@
 
-$(IMAGES_OUTPUTDIR)/lib/_the.jars.contents: $(BUILD_TOOLS) $(IMAGES_OUTPUTDIR)/lib/_the.jars.exclude \
+$(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.jars.contents: $(BUILD_TOOLS) $(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.jars.exclude \
 					 $(ALL_FILES_IN_CLASSES) $(IMAGES_OUTPUTDIR)/lib/classlist
 	$(MKDIR) -p $(@D)
 	$(RM) $@ $@.tmp
 	($(CD) $(JDK_OUTPUTDIR)/classes && \
 	    $(TOOL_JARREORDER) \
-		-o  $@.tmp $(IMAGES_OUTPUTDIR)/lib/classlist $(IMAGES_OUTPUTDIR)/lib/_the.jars.exclude . )
+		-o  $@.tmp $(IMAGES_OUTPUTDIR)/lib/classlist $(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.jars.exclude . )
 	$(MV) $@.tmp $@
 
-$(IMAGES_OUTPUTDIR)/lib/_the.rt.jar.contents: $(IMAGES_OUTPUTDIR)/lib/_the.jars.contents
+$(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.rt.jar.contents: $(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.jars.contents
 	$(MKDIR) -p $(@D)
 	$(RM) $@ $@.tmp
-	$(GREP) -e '\.class$$' $(IMAGES_OUTPUTDIR)/lib/_the.jars.contents > $@.tmp
+	$(GREP) -e '\.class$$' $(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.jars.contents > $@.tmp
+ifneq ($(PROFILE),)
+#       # Add back classes from excluded packages (fixing the $ substitution in the process)
+	for type in  $(subst \$$,\, $(RT_JAR_INCLUDE_TYPES)) ; do \
+	  $(ECHO) $$type >> $@.tmp ; \
+	done
+endif
 	$(MV) $@.tmp $@
 
-$(IMAGES_OUTPUTDIR)/lib/_the.resources.jar.contents: $(IMAGES_OUTPUTDIR)/lib/_the.jars.contents
+$(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.resources.jar.contents: $(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.jars.contents
 	$(MKDIR) -p $(@D)
 	$(RM) $@ $@.tmp
 	$(GREP) -v -e '\.class$$' \
 	    -e '/_the\.*' -e '^_the\.*' -e '\\_the\.*' -e 'javac_state' \
-	    $(IMAGES_OUTPUTDIR)/lib/_the.jars.contents > $@.tmp
+	    $(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.jars.contents > $@.tmp
+ifneq ($(PROFILE),)
+#       # Strip out all META-INF/services/ entries
+	$(GREP) -v -e 'META-INF/services/' $@.tmp > $@.tmp2
+#       # Add back the required services
+#       # FIXME: On Solaris if PROFILE_INCLUDE_METAINF_SERVICES is not defined
+#       # we get a syntax error from sh. That doesn't happen on linux
+	for service in $(PROFILE_INCLUDE_METAINF_SERVICES) ; do \
+	  $(ECHO) $$service >> $@.tmp2; \
+	done
+	$(MV) $@.tmp2 $@.tmp
+endif
 	$(MV) $@.tmp $@
 
+# This is a hack but I don't know how to make this fit into the existing scheme
+$(PROFILE_VERSION_CLASS_TARGETS) : $(PROFILE_VERSION_JAVA_TARGETS)
+	@$(JAVAC) -d $(@D)/../../ $(@D)/$(VERSION_JAVA_FILE)
+
+
+# Support for removing the addPropertyChangeListener and removePropertyChangeListener
+# methods from classes that only go into the profile builds. For now the Pack200.Packer
+# and Packer200.Unpacker classes have special handling because of the $ in the file
+# name.
+BEANLESS_CLASSES = $(IMAGES_OUTPUTDIR)/beanless
+
+$(BEANLESS_CLASSES)/%: $(JDK_OUTPUTDIR)/classes/%
+	$(MKDIR) -p $(@D)
+	$(TOOL_REMOVEMETHODS) $< $@ addPropertyChangeListener removePropertyChangeListener
+
+CLASSES_TO_DEBEAN = \
+    java/util/logging/LogManager.class \
+    com/sun/java/util/jar/pack/PackerImpl.class \
+    com/sun/java/util/jar/pack/UnpackerImpl.class
+
+BEANLESS_CLASSES_TARGETS =
+ifneq ($(PROFILE),)
+    BEANLESS_CLASSES_TARGETS := $(foreach c, $(CLASSES_TO_DEBEAN), $(BEANLESS_CLASSES)/$c)
+endif
+
+
 RT_JAR_CREATE_OPTIONS := c0fm
+RT_JAR_UPDATE_OPTIONS := u0f
 ifeq ($(COMPRESS_JARS), true)
     RT_JAR_CREATE_OPTIONS := cfm
+    RT_JAR_UPDATE_OPTIONS := uf
 endif
 
-$(IMAGES_OUTPUTDIR)/lib/rt.jar: $(IMAGES_OUTPUTDIR)/lib/_the.rt.jar.contents $(RT_JAR_MANIFEST_FILE)
-	$(ECHO) Creating rt.jar
+# This defines a target-specific variables to make the shell logic easier to see.
+# We need to find the Version.class file for the profile currently being built
+$(IMAGES_OUTPUTDIR)/lib$(PROFILE)/rt.jar: \
+  CLASS_FILE = $(if $(PROFILE),$(strip $(foreach class,$(PROFILE_VERSION_CLASS_TARGETS),$(if $(findstring $(PROFILE),$(class)),$(class)))), NO_SUCH_FILE)
+# This is the real target
+$(IMAGES_OUTPUTDIR)/lib$(PROFILE)/rt.jar: $(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.rt.jar.contents $(RT_JAR_MANIFEST_FILE) $(PROFILE_VERSION_CLASS_TARGETS) $(BEANLESS_CLASSES_TARGETS)
+	$(ECHO) Creating rt.jar $(PROFILE) Compressed=$(COMPRESS_JARS)
 	$(MKDIR) -p $(@D)
 	$(RM) $@ $@.tmp
 	$(CD) $(JDK_OUTPUTDIR)/classes && \
 	    $(JAR) $(RT_JAR_CREATE_OPTIONS) $@.tmp $(RT_JAR_MANIFEST_FILE) \
-	        @$(IMAGES_OUTPUTDIR)/lib/_the.rt.jar.contents
+	        @$(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.rt.jar.contents && \
+	    if [ -f $(CLASS_FILE) ]; then \
+	      $(ECHO)  Updating rt.jar $(PROFILE) && \
+	      $(CD) $(patsubst %$(VERSION_CLASS_PATH),%,$(CLASS_FILE)) && \
+                $(JAR) $(RT_JAR_UPDATE_OPTIONS) $@.tmp $(VERSION_CLASS_PATH); \
+	      $(MKDIR) -p $(BEANLESS_CLASSES)/java/util/jar; \
+	      $(TOOL_REMOVEMETHODS) $(JDK_OUTPUTDIR)/classes/java/util/jar/Pack200\$$Packer.class \
+		$(BEANLESS_CLASSES)/java/util/jar/Pack200\$$Packer.class addPropertyChangeListener removePropertyChangeListener; \
+	      $(TOOL_REMOVEMETHODS) $(JDK_OUTPUTDIR)/classes/java/util/jar/Pack200\$$Unpacker.class \
+		$(BEANLESS_CLASSES)/java/util/jar/Pack200\$$Unpacker.class addPropertyChangeListener removePropertyChangeListener; \
+	      $(CD) $(BEANLESS_CLASSES) && \
+		$(JAR) $(RT_JAR_UPDATE_OPTIONS) $@.tmp $(CLASSES_TO_DEBEAN) java/util/jar/* ; \
+            fi
 	$(MV) $@.tmp $@
 
-$(IMAGES_OUTPUTDIR)/lib/resources.jar: $(IMAGES_OUTPUTDIR)/lib/_the.resources.jar.contents \
+$(IMAGES_OUTPUTDIR)/lib$(PROFILE)/resources.jar: $(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.resources.jar.contents \
 				    $(RESOURCE_JAR_MANIFEST_FILE)
 	$(ECHO) Creating resources.jar
 	$(MKDIR) -p $(@D)
 	$(RM) $@ $@.tmp
 	$(CD) $(JDK_OUTPUTDIR)/classes && \
 	    $(JAR) $(RT_JAR_CREATE_OPTIONS) $@.tmp $(RESOURCE_JAR_MANIFEST_FILE) \
-	        @$(IMAGES_OUTPUTDIR)/lib/_the.resources.jar.contents
+	        @$(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.resources.jar.contents
 	$(MV) $@.tmp $@
 
-JARS+=$(IMAGES_OUTPUTDIR)/lib/rt.jar $(IMAGES_OUTPUTDIR)/lib/resources.jar
-
 ##########################################################################################
 
 ifneq ($(OPENJDK_TARGET_OS), windows)
@@ -393,8 +444,6 @@
 		SKIP_METAINF := true, \
                 CHECK_COMPRESS_JAR:=true))
 
-JARS+=$(IMAGES_OUTPUTDIR)/lib/charsets.jar
-
 ##########################################################################################
 
 ifndef OPENJDK
@@ -408,7 +457,6 @@
 		MANIFEST:=$(MAINMANIFEST), \
                 CHECK_COMPRESS_JAR:=true))
 
-    JARS+=$(IMAGES_OUTPUTDIR)/lib/jfr.jar
 endif
 endif
 
@@ -425,8 +473,6 @@
 		MANIFEST:=$(MAINMANIFEST), \
                 CHECK_COMPRESS_JAR:=true))
 
-JARS+=$(IMAGES_OUTPUTDIR)/lib/jsse.jar
-
 ##########################################################################################
 # Create manifest for security jars
 
@@ -446,7 +492,8 @@
 
 ##########################################################################################
 # For all security jars, always build the jar, but for closed, install the prebuilt signed
-# version instead of the newly built jar. For open, signing is not needed. See SignJars.gmk
+# version instead of the newly built jar. Unsigned jars are treated as intermediate targets
+# and explicitly added to the JARS list. For open, signing is not needed. See SignJars.gmk
 # for more information.
 
 SUNPKCS11_JAR_DST := $(IMAGES_OUTPUTDIR)/lib/ext/sunpkcs11.jar
@@ -472,7 +519,7 @@
 	$(install-file)
 endif
 
-JARS += $(SUNPKCS11_JAR_DST) $(SUNPKCS11_JAR_UNSIGNED)
+JARS += $(SUNPKCS11_JAR_UNSIGNED)
 
 ##########################################################################################
 
@@ -499,7 +546,7 @@
 	$(install-file)
 endif
 
-JARS += $(SUNEC_JAR_DST) $(SUNEC_JAR_UNSIGNED)
+JARS += $(SUNEC_JAR_UNSIGNED)
 
 ##########################################################################################
 
@@ -512,8 +559,6 @@
 		JAR:=$(IMAGES_OUTPUTDIR)/lib/dt.jar,\
 		SKIP_METAINF:=true))
 
-JARS+=$(IMAGES_OUTPUTDIR)/lib/dt.jar
-
 ##########################################################################################
 
 SUNJCE_PROVIDER_JAR_DST := $(IMAGES_OUTPUTDIR)/lib/ext/sunjce_provider.jar
@@ -539,7 +584,7 @@
 	$(install-file)
 endif
 
-JARS += $(SUNJCE_PROVIDER_JAR_DST) $(SUNJCE_PROVIDER_JAR_UNSIGNED)
+JARS += $(SUNJCE_PROVIDER_JAR_UNSIGNED)
 
 ##########################################################################################
 
@@ -566,7 +611,7 @@
 	$(install-file)
 endif
 
-JARS += $(JCE_JAR_DST) $(JCE_JAR_UNSIGNED)
+JARS +=  $(JCE_JAR_UNSIGNED)
 
 ##########################################################################################
 
@@ -604,7 +649,7 @@
 	$(install-file)
 endif
 
-JARS += $(US_EXPORT_POLICY_JAR_DST) $(US_EXPORT_POLICY_JAR_UNSIGNED)
+JARS += $(US_EXPORT_POLICY_JAR_UNSIGNED)
 
 ##########################################################################################
 
@@ -647,7 +692,7 @@
 	$(install-file)
 endif
 
-JARS += $(LOCAL_POLICY_JAR_DST) $(LOCAL_POLICY_JAR_UNSIGNED)
+JARS += $(LOCAL_POLICY_JAR_UNSIGNED)
 
 ##########################################################################################
 
@@ -676,7 +721,7 @@
 	$(install-file)
 endif
 
-JARS += $(SUNMSCAPI_JAR_DST) $(SUNMSCAPI_JAR_UNSIGNED)
+JARS += $(SUNMSCAPI_JAR_UNSIGNED)
 
 endif
 
@@ -703,7 +748,7 @@
 	@$(ECHO) $(LOG_INFO) "\n>>>Installing prebuilt OracleUcrypto provider..."
 	$(install-file)
 
-JARS += $(UCRYPTO_JAR_DST) $(UCRYPTO_JAR_UNSIGNED)
+JARS += $(UCRYPTO_JAR_UNSIGNED) 
 
 endif
 endif
@@ -726,8 +771,6 @@
 		EXTRA_MANIFEST_ATTR:=CLDR-Version: $(CLDRVERSION),\
 		SKIP_METAINF:=true))
 
-JARS += $(CLDRDATA_JAR_DST)
-
 ##########################################################################################
 
 TOOLS_JAR_INCLUDES := \
@@ -801,7 +844,6 @@
 		SKIP_METAINF:=true, \
                 CHECK_COMPRESS_JAR:=true))
 
-JARS+=$(IMAGES_OUTPUTDIR)/lib/tools.jar
 
 ##########################################################################################
 
@@ -842,6 +884,7 @@
 	    -processor com.sun.tools.javac.sym.CreateSymbols \
 	    -Acom.sun.tools.javac.sym.Jar=$(IMAGES_OUTPUTDIR)/lib/rt.jar \
 	    -Acom.sun.tools.javac.sym.Dest=$(IMAGES_OUTPUTDIR)/symbols/META-INF/sym/rt.jar \
+	    -Acom.sun.tools.javac.sym.Profiles=profile-rtjar-includes.txt \
 	    $(CORE_PKGS) $(NON_CORE_PKGS) $(EXCLUDE_PROPWARN_PKGS) $(EXPORTED_PRIVATE_PKGS)
 	$(TOUCH) $@
 
@@ -852,7 +895,6 @@
 		JAR:=$(IMAGES_OUTPUTDIR)/lib/ct.sym, \
 		CHECK_COMPRESS_JAR:=true))
 
-JARS+=$(IMAGES_OUTPUTDIR)/lib/ct.sym
 
 ##########################################################################################
 
@@ -938,8 +980,6 @@
 		ZIP:=$(IMAGES_OUTPUTDIR)/src.zip,\
 		EXTRA_DEPS:=$(LAUNCHER_ZIP_SRC)))
 
-JARS+=$(IMAGES_OUTPUTDIR)/src.zip
-
 ##########################################################################################
 
 ifndef OPENJDK
@@ -990,15 +1030,11 @@
 $(IMAGES_OUTPUTDIR)/lib/management-agent.jar : $(JDK_TOPDIR)/src/share/classes/sun/management/manifest
 	$(JAR) cfm $@ $<
 
-JARS += $(IMAGES_OUTPUTDIR)/lib/management-agent.jar
-
 ##########################################################################################
 
 $(IMAGES_OUTPUTDIR)/lib/ext/zipfs.jar : $(JDK_OUTPUTDIR)/demo/nio/zipfs/zipfs.jar
 	$(install-file)
 
-JARS += $(IMAGES_OUTPUTDIR)/lib/ext/zipfs.jar
-
 ##########################################################################################
 
 ifeq ($(OPENJDK_TARGET_OS),macosx)
@@ -1006,8 +1042,6 @@
 		SRCS:=$(JDK_OUTPUTDIR)/jobjc_classes,\
 		JAR:=$(IMAGES_OUTPUTDIR)/lib/JObjC.jar, \
 		JARINDEX:=true))
-
-    JARS += $(IMAGES_OUTPUTDIR)/lib/JObjC.jar
 endif
 
 ##########################################################################################
@@ -1017,7 +1051,6 @@
 		SRCS:=$(JDK_OUTPUTDIR)/altclasses_classes,\
 		JAR:=$(IMAGES_OUTPUTDIR)/lib/alt-rt.jar))
 
-    JARS += $(IMAGES_OUTPUTDIR)/lib/alt-rt.jar
 endif
 
 ##########################################################################################
@@ -1028,8 +1061,6 @@
 $(IMAGES_OUTPUTDIR)/lib/sa-jdi.jar: $(JDK_OUTPUTDIR)/lib/sa-jdi.jar
 	$(install-file)
 
-JARS += $(IMAGES_OUTPUTDIR)/lib/sa-jdi.jar
-
 ##########################################################################################
 #
 # sec-bin.zip is used by builds where the corresponding sources are not available
--- a/makefiles/GensrcMisc.gmk	Thu Feb 21 17:55:33 2013 -0800
+++ b/makefiles/GensrcMisc.gmk	Tue Feb 26 12:54:39 2013 +0400
@@ -23,24 +23,29 @@
 # questions.
 #
 
+include ProfileNames.gmk
+
 ##########################################################################################
 # Install the launcher name, release version string, full version
 # string and the runtime name into the Version.java file.
 # To be printed by java -version
 
-$(JDK_OUTPUTDIR)/gensrc/sun/misc/Version.java: \
-	$(JDK_TOPDIR)/src/share/classes/sun/misc/Version.java.template
+$(JDK_OUTPUTDIR)/gensrc/sun/misc/Version.java \
+$(PROFILE_VERSION_JAVA_TARGETS): \
+		$(JDK_TOPDIR)/src/share/classes/sun/misc/Version.java.template
 	$(MKDIR) -p $(@D)
 	$(RM) $@ $@.tmp
-	$(ECHO) $(LOG_INFO) Generating sun/misc/Version.java
+	$(ECHO) Generating sun/misc/Version.java $(call profile_version_name, $@)
 	$(SED) -e 's/@@launcher_name@@/$(LAUNCHER_NAME)/g' \
 	       -e 's/@@java_version@@/$(RELEASE)/g' \
 	       -e 's/@@java_runtime_version@@/$(FULL_VERSION)/g' \
 	       -e 's/@@java_runtime_name@@/$(RUNTIME_NAME)/g' \
+	       -e 's/@@java_profile_name@@/$(call profile_version_name, $@)/g' \
             $< > $@.tmp
 	$(MV) $@.tmp $@
 
-GENSRC_MISC += $(JDK_OUTPUTDIR)/gensrc/sun/misc/Version.java
+GENSRC_MISC += $(JDK_OUTPUTDIR)/gensrc/sun/misc/Version.java \
+    $(PROFILE_VERSION_JAVA_TARGETS)
 
 ##########################################################################################
 # Version file for jconsole
--- a/makefiles/Images.gmk	Thu Feb 21 17:55:33 2013 -0800
+++ b/makefiles/Images.gmk	Tue Feb 26 12:54:39 2013 +0400
@@ -41,6 +41,8 @@
 
 include Tools.gmk
 
+include Profiles.gmk
+
 # Note: This double-colon rule is intentional, to support
 # custom make file integration.
 images:: jre-image jdk-image
@@ -84,7 +86,7 @@
 ################################################################################
 #
 # Variable prefixes explained:
-# JRE_ refers to files in the j2re-image.
+# JRE_ refers to files in the j2re-*-image.
 # JDK_ refers to files in the j2sdk-image outside of the jre subdir.
 # JDKJRE_ refers to files in the j2sdk-image inside the jre subdir.
 #
@@ -92,7 +94,8 @@
 ################################################################################
 # /bin dir
 
-NOT_JRE_BIN_FILES := \
+ifeq ($(PROFILE),)
+    NOT_JRE_BIN_FILES := \
 	appletviewer$(EXE_SUFFIX) \
 	extcheck$(EXE_SUFFIX) \
 	idlj$(EXE_SUFFIX) \
@@ -125,6 +128,7 @@
         schemagen$(EXE_SUFFIX) \
 	jsadebugd$(EXE_SUFFIX) \
 	jhat$(EXE_SUFFIX)
+endif
 
 WINDOWS_JDK_BIN_FILES = \
 	$(EXE_SUFFIX) \
@@ -196,7 +200,8 @@
 	$(SALIB_NAME)
 endif
 
-NOT_JRE_LIB_FILES := \
+ifeq ($(PROFILE),)
+    NOT_JRE_LIB_FILES := \
 	tools.jar \
 	jconsole.jar \
 	sa-jdi.jar \
@@ -205,8 +210,9 @@
 	ir.idl \
 	ct.sym
 
-ifeq ($(OPENJDK_TARGET_OS), windows)
-    NOT_JRE_LIB_FILES += jawt.lib jvm.lib
+    ifeq ($(OPENJDK_TARGET_OS), windows)
+      NOT_JRE_LIB_FILES += jawt.lib jvm.lib
+    endif
 endif
 
 JDK_LIB_FILES := $(NOT_JRE_LIB_FILES)
@@ -607,6 +613,9 @@
 $(JRE_INFO_FILE): $(OUTPUT_ROOT)/spec.gmk $(OUTPUT_ROOT)/source_tips
 	$(ECHO) $(LOG_INFO) Generating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
 	$(call create-info-file)
+ifneq ($(PROFILE),)
+	$(call info-file-item, "JAVA_PROFILE", "$(call profile_name, $(call profile_number, $(PROFILE)))")
+endif
 
 $(JDK_INFO_FILE): $(OUTPUT_ROOT)/spec.gmk $(OUTPUT_ROOT)/source_tips
 	$(ECHO) $(LOG_INFO) Generating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
@@ -648,7 +657,7 @@
     EXEC_LIST_OVERLAY:=$(filter $(OVERLAY_FILTER),$(EXEC_LIST_BIN)) $(EXEC_LIST_LIB)
 
     # Filter out non JRE files and convert to unique touch files to depend on
-    JRE_STRIP_LIST:=$(patsubst $(JDK_OUTPUTDIR)/%,$(IMAGES_OUTPUTDIR)/_strip_jre/%.stripped,\
+    JRE_STRIP_LIST:=$(patsubst $(JDK_OUTPUTDIR)/%,$(IMAGES_OUTPUTDIR)/_strip_jre$(PROFILE)/%.stripped,\
 			$(filter-out $(addprefix %,$(NOT_JRE_BIN_FILES) $(NOT_JRE_LIB_FILES) $(JDKJRE_LIB_FILES)),\
 				 $(EXEC_LIST)))
 
@@ -688,7 +697,7 @@
     endef
 
     # Setup a rule for stripping files based on touch files
-    $(IMAGES_OUTPUTDIR)/_strip_jre/%.stripped: $(JRE_IMAGE_DIR)/%
+    $(IMAGES_OUTPUTDIR)/_strip_jre$(PROFILE)/%.stripped: $(JRE_IMAGE_DIR)/%
 	$(call strip-file)
 
     $(IMAGES_OUTPUTDIR)/_strip_jdk/%.stripped: $(JDK_IMAGE_DIR)/%
@@ -728,6 +737,29 @@
 	$(JDK_OVERLAY_DEMO_TARGETS) $(JDK_OVERLAY_INFO_FILE) \
 	$(JDKJRE_OVERLAY_STRIP_LIST) $(JDK_OVERLAY_BIN_STRIP_LIST) 
 
+ifneq ($(PROFILE),)
+# Files in lib$(PROFILE) are excluded from the generic copying routines so
+# we have to add them back in here
+$(foreach f,$(CUSTOM_PROFILE_JARS),\
+    $(eval $(call AddFileToCopy,$(IMAGES_OUTPUTDIR)/lib$(PROFILE),$(JRE_IMAGE_DIR)/lib,$f,JRE_LIB_TARGETS)))
+
+PROFILE_IMAGE_JARS := $(filter %.jar, $(JRE_LIB_TARGETS))
+
+PROFILE_IMAGE_JARS_CHECKED := $(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_jars_checked
+
+$(PROFILE_IMAGE_JARS_CHECKED) : $(PROFILE_IMAGE_JARS)
+	$(TOOL_CHECKDEPS) $(JRE_IMAGE_DIR) \
+	    $(call profile_name, $(call profile_number, $(PROFILE)))
+	$(TOUCH) $@
+
+profile-image: $(JRE_BIN_TARGETS) $(JRE_LIB_TARGETS) \
+	$(JRE_IMAGE_DIR)/lib/meta-index $(JRE_IMAGE_DIR)/lib/ext/meta-index \
+	$(JRE_INFO_FILE) $(JRE_STRIP_LIST) $(PROFILE_IMAGE_JARS_CHECKED)
+
+.PHONY: profile-image
+
+endif # Profile
+
 ################################################################################
 
 .PHONY: default images jre-image jdk-image
--- a/makefiles/Import.gmk	Thu Feb 21 17:55:33 2013 -0800
+++ b/makefiles/Import.gmk	Tue Feb 26 12:54:39 2013 +0400
@@ -100,33 +100,13 @@
 
 #######
 
-ifeq ($(OPENJDK_TARGET_OS),solaris)
-define do-install-file
-	$(MKDIR) -p '$$(@D)'
-	$(RM) '$$@'
-	$(CP) -r -P '$$<' '$$(@D)'
-endef
-else ifeq ($(OPENJDK_TARGET_OS),macosx)
-define do-install-file
-	$(MKDIR) -p '$$(@D)'
-	$(RM) '$$@'
-	$(CP) -pRP '$$<' '$$@'
-endef
-else
-define do-install-file
-	$(MKDIR) -p '$$(@D)'
-	$(RM) '$$@'
-	$(CP) -P '$$<' '$$@'
-endef
-endif
-
 define CopyDir
         $1_SRC_FILES := $(shell $(FIND) $2 -type f -a \( -name DUMMY $(addprefix -o$(SPACE)-name$(SPACE),$4) \))
         $1_DST_FILES := $$(patsubst $2/%,$3/%,$$($1_SRC_FILES))
         IMPORT_TARGET_FILES += $$($1_DST_FILES)
 $3/% : $2/%
 	$(ECHO) $(LOG_INFO) Copying $$(@F)
-	$(do-install-file)
+	$$(install-file)
 endef
 
 #######
@@ -155,6 +135,12 @@
             IMPORT_TARGET_FILES += $(INSTALL_LIBRARIES_HERE)/client/$(foreach I,$(JSIG_DEBUGINFO),$(notdir $I))
         endif
     endif
+    ifeq ($(JVM_VARIANT_MINIMAL1), true)
+        IMPORT_TARGET_FILES += $(INSTALL_LIBRARIES_HERE)/minimal/$(LIBRARY_PREFIX)jsig$(SHARED_LIBRARY_SUFFIX)
+        ifneq (,$(JSIG_DEBUGINFO))
+            IMPORT_TARGET_FILES += $(INSTALL_LIBRARIES_HERE)/minimal/$(foreach I,$(JSIG_DEBUGINFO),$(notdir $I))
+        endif
+    endif
 endif
 
 $(INSTALL_LIBRARIES_HERE)/server/%$(SHARED_LIBRARY_SUFFIX) : $(INSTALL_LIBRARIES_HERE)/%$(SHARED_LIBRARY_SUFFIX)
@@ -195,27 +181,24 @@
 	$(RM) $(basename $@).debuginfo
 	$(MV) $@.tmp $@
 
-#######
+$(INSTALL_LIBRARIES_HERE)/minimal/%$(SHARED_LIBRARY_SUFFIX) : $(INSTALL_LIBRARIES_HERE)/%$(SHARED_LIBRARY_SUFFIX)
+	$(MKDIR) -p $(@D)
+	$(RM) $@
+	$(LN) -s ../$(@F) $@
 
-ifeq ($(OPENJDK_TARGET_OS),solaris)
-define install-file
-	$(MKDIR) -p '$(@D)'
-	$(RM) '$@'
-	$(CP) -r -P '$<' '$(@D)'
-endef
-else ifeq ($(OPENJDK_TARGET_OS),macosx)
-define install-file
-	$(MKDIR) -p '$(@D)'
-	$(RM) '$@'
-	$(CP) -pRP '$<' '$@'
-endef
-else
-define install-file
-	$(MKDIR) -p '$(@D)'
-	$(RM) '$@'
-	$(CP) -P '$<' '$@'
-endef
-endif
+$(INSTALL_LIBRARIES_HERE)/minimal/%.debuginfo : $(INSTALL_LIBRARIES_HERE)/%.debuginfo
+	$(MKDIR) -p $(@D)
+	$(RM) $@
+	$(LN) -s ../$(@F) $@
+
+$(INSTALL_LIBRARIES_HERE)/minimal/%.diz : $(INSTALL_LIBRARIES_HERE)/%.diz
+	$(MKDIR) -p $(@D)
+	$(RM) $@
+	$(RM) $@.tmp $(basename $@).debuginfo
+	$(LN) -s ../$(basename $(@F)).debuginfo $(basename $@).debuginfo
+	$(CD) $(@D) && $(ZIP) -q -y $@.tmp $(basename $(@F)).debuginfo
+	$(RM) $(basename $@).debuginfo
+	$(MV) $@.tmp $@
 
 #######
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/makefiles/ProfileNames.gmk	Tue Feb 26 12:54:39 2013 +0400
@@ -0,0 +1,65 @@
+#
+# Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+# This was split out from Profiles.gmk to allow GenSrcMisc.gmk to include it
+# without attempting to generate lists for output files that don't exist yet
+
+# These are the external names of each profile
+
+PROFILE_NAMES := compact1 compact2 compact3
+
+# The include files use 1,2,3,4 for simplicity and conciseness. Internally we
+# use profile_1, profile_2 and profile_3. Note that profile_4 is a full JRE so
+# we never have to use it directly.
+
+ALL_PROFILES := profile_1 profile_2 profile_3
+
+# This defines targets to generate per-profile Version.java/class files into
+# distinct locations
+
+VERSION_JAVA_DIR := sun/misc
+VERSION_JAVA_FILE := Version.java
+VERSION_JAVA_PATH := $(VERSION_JAVA_DIR)/$(VERSION_JAVA_FILE)
+VERSION_CLASS_PATH := $(VERSION_JAVA_PATH:.java=.class)
+
+PROFILE_VERSION_JAVA_TARGETS := $(foreach i, $(ALL_PROFILES), $(subst XXX,$i, $(JDK_OUTPUTDIR)/gen_XXX/$(VERSION_JAVA_PATH)))
+
+PROFILE_VERSION_CLASS_TARGETS := $(foreach i, $(PROFILE_VERSION_JAVA_TARGETS), $(i:.java=.class))
+
+# Function to map from profile designator, profile_1 etc, to its number
+profile_number = $(if $(patsubst profile_%,%, $(1)),$(patsubst profile_%,%, $(1)), $(words $(PROFILE_NAMES) extra))
+
+# Function to map from profile number, 1, 2 etc, to the corresponding name
+# An invalid number maps to an empty name
+profile_name = $(word $(1), $(PROFILE_NAMES))
+
+# Function to isolate a profile number from a Version.java target
+# Evaluates to the arg if the arg is not a profile version target
+profile_version_number = $(patsubst $(JDK_OUTPUTDIR)/gen_profile_%/$(VERSION_JAVA_PATH), %, $(1))
+
+# Function to go from a profile Version.java target to profile name. If not 
+# a profile version target then we need a number that maps to an empty name
+profile_version_name = $(word $(if $(filter-out $(call profile_version_number, $(1)), $(1)), $(call profile_version_number, $(1)), $(words $(PROFILE_NAMES) extra)), $(PROFILE_NAMES))
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/makefiles/Profiles.gmk	Tue Feb 26 12:54:39 2013 +0400
@@ -0,0 +1,331 @@
+#
+# Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+include ProfileNames.gmk
+
+# This defines the include lists for each profile, categorized as lib, bin
+# and other. We can use these to define the file lists for each profile
+# directly, rather than constructing a set of files to exclude from the
+# set of all files. But initially we will stick with generating exclude lists
+# as that is how the main build process already works.
+
+include profile-includes.txt
+
+###############################################################################
+# Per profile Jar lists
+#
+# These are the jar files to be built. In some builds these have to be
+# imported (signed jars) rather than built.
+#
+# The incoming lists, eg PROFILE_1_JRE_JARS_FILES, are the jars to be
+# included in this profile. They have the jar name relative to the lib 
+# directory. We have to turn these into targets by adding the 
+# $(IMAGES_OUTPUTDIR)/lib prefix
+#
+# Note that some jars may be optional depending on the type of build (jdk vs.
+# openjdk) and the platform.
+#
+# WARNING: incoming lists are currently validated for linux only!
+###############################################################################
+
+# These are jar files for which the contents vary depending on the profile
+CUSTOM_JARS := rt.jar resources.jar
+# This is used in Images.gmk
+CUSTOM_PROFILE_JARS := $(addprefix $(IMAGES_OUTPUTDIR)/lib$(PROFILE)/, $(CUSTOM_JARS))
+
+# These are the common jar files built for and included with this profile
+# Filter out the custom jars and turn them into targets.
+
+PROFILE_1_JARS :=  \
+    $(addprefix $(IMAGES_OUTPUTDIR)/lib/, $(filter-out $(CUSTOM_JARS), $(PROFILE_1_JRE_JAR_FILES)))
+
+PROFILE_2_JARS := \
+    $(if $(PROFILE_2_JRE_JAR_FILES), $(addprefix $(IMAGES_OUTPUTDIR)/lib/, $(PROFILE_2_JRE_JAR_FILES))) \
+    $(PROFILE_1_JARS)
+
+ifneq ($(ENABLE_JFR), true)
+  PROFILE_3_JRE_JAR_FILES :=  $(filter-out jfr.jar, $(PROFILE_3_JRE_JAR_FILES))
+endif
+
+PROFILE_3_JARS := \
+    $(addprefix $(IMAGES_OUTPUTDIR)/lib/, $(PROFILE_3_JRE_JAR_FILES)) \
+    $(PROFILE_2_JARS)
+
+ifdef OPENJDK
+  PROFILE_4_JRE_JAR_FILES := $(filter-out alt-rt.jar, $(PROFILE_4_JRE_JAR_FILES))
+endif
+
+PROFILE_4_JARS := \
+    $(addprefix $(IMAGES_OUTPUTDIR)/lib/, $(PROFILE_4_JRE_JAR_FILES)) \
+    $(PROFILE_3_JARS)
+
+# The full set of "jar" files needed for a complete JDK (ct.sym and src.zip
+# are also included.)
+# Note we need to add back the regular form of all the custom profile jars e.g.
+# rt.jar and resources.jar
+
+ALL_JARS := $(PROFILE_4_JARS) \
+        $(IMAGES_OUTPUTDIR)/lib/rt.jar \
+        $(IMAGES_OUTPUTDIR)/lib/resources.jar \
+        $(IMAGES_OUTPUTDIR)/lib/jconsole.jar \
+        $(IMAGES_OUTPUTDIR)/lib/dt.jar \
+        $(IMAGES_OUTPUTDIR)/lib/tools.jar \
+        $(IMAGES_OUTPUTDIR)/lib/ct.sym \
+        $(IMAGES_OUTPUTDIR)/src.zip \
+        $(IMAGES_OUTPUTDIR)/lib/ext/cldrdata.jar \
+        $(IMAGES_OUTPUTDIR)/lib/sa-jdi.jar
+
+ifeq ($(OPENJDK_TARGET_OS),solaris)
+    ifndef OPENJDK
+        ALL_JARS += $(IMAGES_OUTPUTDIR)/lib/ext/ucrypto.jar
+    endif
+endif
+
+ifeq ($(OPENJDK_TARGET_OS),windows)
+    ALL_JARS += $(IMAGES_OUTPUTDIR)/lib/ext/sunmscapi.jar
+endif 
+
+ifeq ($(OPENJDK_TARGET_OS),macosx)
+    ALL_JARS += $(IMAGES_OUTPUTDIR)/lib/JObjC.jar
+endif
+
+ifeq ($(PROFILE), profile_1)
+    PROFILE_JARS := $(PROFILE_1_JARS)
+else ifeq ($(PROFILE), profile_2)
+    PROFILE_JARS := $(PROFILE_2_JARS)
+else ifeq ($(PROFILE), profile_3)
+    PROFILE_JARS := $(PROFILE_3_JARS)
+endif
+ifneq ($(PROFILE),)
+    JARS := $(CUSTOM_PROFILE_JARS) $(PROFILE_JARS)
+else
+    JARS := $(ALL_JARS)
+endif
+
+###############################################################################
+# JRE contents
+###############################################################################
+
+
+# we don't need to do anything if not building a profile
+ifneq ($(PROFILE),)
+
+
+# Need all files to generate the exclude lists
+NEW_ALL_BIN_LIST := $(patsubst $(JDK_OUTPUTDIR)/bin/%,%,$(shell $(FIND) $(JDK_OUTPUTDIR)/bin \( -type f -o -type l \) ! -name "sjavac"))
+
+ALL_JRE_BIN_FILES := \
+   $(PROFILE_1_JRE_BIN_FILES) \
+   $(PROFILE_2_JRE_BIN_FILES) \
+   $(PROFILE_3_JRE_BIN_FILES) \
+   $(PROFILE_4_JRE_BIN_FILES) 
+
+NOT_JRE_BIN_FILES := $(filter-out $(ALL_JRE_BIN_FILES), $(NEW_ALL_BIN_LIST))
+
+# Additional exclusions for profile JRE
+ifeq ($(PROFILE), profile_1)
+    NOT_JRE_BIN_FILES += \
+        $(PROFILE_2_JRE_BIN_FILES) \
+        $(PROFILE_3_JRE_BIN_FILES) \
+        $(PROFILE_4_JRE_BIN_FILES) 
+endif
+
+ifeq ($(PROFILE), profile_2)
+    NOT_JRE_BIN_FILES += \
+        $(PROFILE_3_JRE_BIN_FILES) \
+        $(PROFILE_4_JRE_BIN_FILES) 
+endif
+
+ifeq ($(PROFILE), profile_3)
+    NOT_JRE_BIN_FILES += \
+        $(PROFILE_4_JRE_BIN_FILES) 
+endif
+
+NOT_JRE_BIN_FILES := $(addprefix $(JDK_OUTPUTDIR)/bin/, $(NOT_JRE_BIN_FILES))
+
+# Need all files to generate the exclude lists
+NEW_ALL_LIB_LIST := $(patsubst $(JDK_OUTPUTDIR)/lib/%,%,$(shell $(FIND) $(JDK_OUTPUTDIR)/lib \( -type f -o -type l \) -a ! \( -name "_the*" -o -name "javac_state " \) ))
+NEW_ALL_LIB_LIST += $(patsubst $(IMAGES_OUTPUTDIR)/lib/%,%,$(shell $(FIND) $(IMAGES_OUTPUTDIR)/lib \( -type f -o -type l \) -a ! \( -name "_the*" -o -name "javac_state " \) ))
+
+ALL_JRE_LIB_FILES := \
+   $(PROFILE_1_JRE_LIB_FILES) \
+   $(PROFILE_2_JRE_LIB_FILES) \
+   $(PROFILE_3_JRE_LIB_FILES) \
+   $(PROFILE_4_JRE_LIB_FILES) 
+
+NOT_JRE_LIB_FILES := $(filter-out $(ALL_JRE_LIB_FILES), $(NEW_ALL_LIB_LIST))
+
+# Although these are NOT JRE lib files we have to filter them from the list
+# (ie cause them to be added them back in here) because the logic in
+# Images.gmk expects them to be there and handles them differently.
+# If we don't, they end up in the wrong place in the JDK image.
+# This needs fixing.
+NOT_JRE_LIB_FILES := $(filter-out $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)attach$(SHARED_LIBRARY_SUFFIX) $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(SALIB_NAME), $(NOT_JRE_LIB_FILES))
+
+# Additional exclusions for profile JREs
+ifeq ($(PROFILE), profile_1)
+    NOT_JRE_LIB_FILES += \
+        $(PROFILE_2_JRE_LIB_FILES) \
+        $(PROFILE_3_JRE_LIB_FILES) \
+        $(PROFILE_4_JRE_LIB_FILES) 
+endif
+
+ifeq ($(PROFILE), profile_2)
+    NOT_JRE_LIB_FILES += \
+        $(PROFILE_3_JRE_LIB_FILES) \
+        $(PROFILE_4_JRE_LIB_FILES) 
+endif
+
+ifeq ($(PROFILE), profile_3)
+    NOT_JRE_LIB_FILES += \
+        $(PROFILE_4_JRE_LIB_FILES) 
+endif
+
+# Exclude the custom jar files as these will be added back via a special rule
+NOT_JRE_LIB_FILES += $(CUSTOM_JARS)
+
+###############################################################################
+# Customization of rt.jar file contents
+# These are expressed as exclusions from everything found in the 
+# JDK_OUTPUTDIR/classes directory
+###############################################################################
+
+# The main set of excluded types/packages (ie everything not destined to be
+# part of rt.jar or resources.jar is captured in the CreateJars.gmk RT_JAR_EXCLUDES
+# variable. We add to that for the per-profile exclusion lists
+
+# For each profile we have four variables:
+#
+# - PROFILE_n_RTJAR_INCLUDE_PACKAGES
+#
+# This is a package prefix indicating that all classes in that package
+# and conditionally its subpackages are included in rt.jar for this profile.
+# The subpackages will be included as long as they do not appear in the
+# include list of a higher profile
+#
+# - PROFILE_n_RTJAR_INCLUDE_TYPES
+#
+# These are specific types that must be included within a package.
+# There are two cases:
+# - individual types in a package that is otherwise excluded at this 
+#   profile level. The only arises if there are split packages. 
+#
+# - A higher-level package is included in a high profile where a subpackage
+# is included in a lower profile. Including the package in the high profile
+# would exclude it and all subpackages from the lower profile, so instead
+# the classes in the package are listed for that higher profile (as *.class)
+#
+# These types are explicitly added back into the rt.jar content lists.
+#
+# - PROFILE_n_RTJAR_EXCLUDE_TYPES
+#
+# These are specific types that must be excluded even though most of the
+# containing package is include. Again this occurs with split packges.
+#
+# So the exclude list for each profile consists of the include lists
+# for all profiles above it, together with any explicitly excluded types. 
+# This is then combined with the overall RT_JAR_EXCLUDES list (which covers
+# things that go into other jar files).
+#
+# We also have to define the types to be explicitly included. This
+# accumulates up the profiles ie profile 3 has to include the types
+# that profiles 1 and 2 had to include. This is unnecessary if, for example,
+# profile 3 includes the entire package, but it is harmless to add them
+# explicitly, and complex to determine if we still need to include them.
+#
+# Need a way to express: 
+#  for (int i = profile+1; i < 4; i++)
+#     RT_JAR_EXCLUDES += PROFILE_$i_RTJAR_INCLUDE_PACKAGES
+#
+# Do it the long way for now
+#
+# - PROFILE_n_INCLUDE_METAINF_SERVICES
+#
+# These are META-INF/services/ entries found in resources.jar. Together
+# resources.jar and rt.jar hold the contents of the classes directory, (the
+# classes in rt.jar and everything else in resources.jar).Hence the 
+# include/exclude information for resources.jar is tied to that of rt.jar
+
+include profile-rtjar-includes.txt
+
+# Function to expand foo/*.class into the set of classes
+# NOTE: Classfiles with $ in their name are problematic as that is the
+# meta-character for both make and the shell! Hence the \$$$$ substitution.
+# But note that if you echo these values they will NOT display as expected.
+class_list =  $(patsubst $(JDK_OUTPUTDIR)/classes/%,%,\
+     $(foreach i,$(1), $(subst $$,\$$$$, $(wildcard $(JDK_OUTPUTDIR)/classes/$i))))
+
+ifeq ($(PROFILE), profile_1)
+  RT_JAR_EXCLUDES += \
+    $(PROFILE_1_RTJAR_EXCLUDE_TYPES) \
+    $(PROFILE_2_RTJAR_INCLUDE_PACKAGES) \
+    $(call class_list, $(PROFILE_2_RTJAR_INCLUDE_TYPES)) \
+    $(PROFILE_3_RTJAR_INCLUDE_PACKAGES) \
+    $(call class_list, $(PROFILE_3_RTJAR_INCLUDE_TYPES)) \
+    $(PROFILE_4_RTJAR_INCLUDE_PACKAGES) \
+    $(call class_list, $(PROFILE_4_RTJAR_INCLUDE_TYPES))
+  RT_JAR_INCLUDE_TYPES := \
+	$(call class_list, $(PROFILE_1_RTJAR_INCLUDE_TYPES))
+  PROFILE_INCLUDE_METAINF_SERVICES := \
+    $(PROFILE_1_INCLUDE_METAINF_SERVICES)
+endif
+ifeq ($(PROFILE), profile_2)
+  RT_JAR_EXCLUDES += \
+    $(PROFILE_2_RTJAR_EXCLUDE_TYPES) \
+    $(PROFILE_3_RTJAR_INCLUDE_PACKAGES) \
+    $(call class_list, $(PROFILE_3_RTJAR_INCLUDE_TYPES)) \
+    $(PROFILE_4_RTJAR_INCLUDE_PACKAGES) \
+    $(call class_list, $(PROFILE_4_RTJAR_INCLUDE_TYPES))
+  RT_JAR_INCLUDE_TYPES := \
+	$(call class_list, $(PROFILE_1_RTJAR_INCLUDE_TYPES)) \
+	$(call class_list, $(PROFILE_2_RTJAR_INCLUDE_TYPES))
+  PROFILE_INCLUDE_METAINF_SERVICES := \
+    $(PROFILE_1_INCLUDE_METAINF_SERVICES) \
+    $(PROFILE_2_INCLUDE_METAINF_SERVICES)
+endif
+ifeq ($(PROFILE), profile_3)
+  RT_JAR_EXCLUDES += \
+    $(PROFILE_3_RTJAR_EXCLUDE_TYPES) \
+    $(PROFILE_4_RTJAR_INCLUDE_PACKAGES) \
+    $(call class_list, $(PROFILE_4_RTJAR_INCLUDE_TYPES))
+  RT_JAR_INCLUDE_TYPES := \
+	$(call class_list, $(PROFILE_1_RTJAR_INCLUDE_TYPES)) \
+	$(call class_list, $(PROFILE_2_RTJAR_INCLUDE_TYPES)) \
+	$(call class_list, $(PROFILE_3_RTJAR_INCLUDE_TYPES))
+  PROFILE_INCLUDE_METAINF_SERVICES := \
+    $(PROFILE_1_INCLUDE_METAINF_SERVICES) \
+    $(PROFILE_2_INCLUDE_METAINF_SERVICES) \
+    $(PROFILE_3_INCLUDE_METAINF_SERVICES)
+endif
+
+# Filter out non-OpenJDK services
+ifdef OPENJDK
+  EXCLUDED_SERVICES := META-INF/services/javax.script.ScriptEngineFactory 
+  PROFILE_INCLUDE_METAINF_SERVICES := $(filter-out $(EXCLUDED_SERVICES),$(PROFILE_INCLUDE_METAINF_SERVICES))
+endif
+
+
+endif # profile
+
--- a/makefiles/Tools.gmk	Thu Feb 21 17:55:33 2013 -0800
+++ b/makefiles/Tools.gmk	Tue Feb 26 12:54:39 2013 +0400
@@ -53,6 +53,14 @@
 
 BUILD_TOOLS += $(foreach i,$(wildcard $(JDK_TOPDIR)/src/share/classes/javax/swing/plaf/nimbus/*.template),$(JDK_OUTPUTDIR)/btclasses/build/tools/generatenimbus/resources/$(notdir $i))
 
+# Resources used by CheckDeps tool
+$(JDK_OUTPUTDIR)/btclasses/build/tools/deps/% : \
+	$(JDK_TOPDIR)/make/tools/src/build/tools/deps/%
+	$(MKDIR) -p $(@D)
+	$(CP) $< $@
+
+BUILD_TOOLS += $(JDK_OUTPUTDIR)/btclasses/build/tools/deps/refs.allowed
+
 # Add a checksum ("jsum") to the end of a text file. Prevents trivial tampering with class lists.
 TOOL_ADDJSUM=$(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses \
 	build.tools.addjsum.AddJsum
@@ -137,6 +145,14 @@
 TOOL_CLDRCONVERTER=$(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses \
 	build.tools.cldrconverter.CLDRConverter
 
+TOOL_REMOVEMETHODS=$(JAVA) -Xbootclasspath/p:$(LANGTOOLS_OUTPUTDIR)/dist/bootstrap/lib/javac.jar \
+    -cp $(JDK_OUTPUTDIR)/btclasses:$(JDK_OUTPUTDIR) \
+        build.tools.classfile.RemoveMethods
+
+TOOL_CHECKDEPS=$(JAVA) -Xbootclasspath/p:$(LANGTOOLS_OUTPUTDIR)/dist/bootstrap/lib/javac.jar \
+    -cp $(JDK_OUTPUTDIR)/btclasses:$(JDK_OUTPUTDIR) \
+        build.tools.deps.CheckDeps
+
 ##########################################################################################
 
 # Tools needed on solaris because OBJCOPY is broken.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/makefiles/profile-includes.txt	Tue Feb 26 12:54:39 2013 +0400
@@ -0,0 +1,258 @@
+#
+# Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+PROFILE_1_JRE_BIN_FILES := \
+    java$(EXE_SUFFIX) \
+    keytool$(EXE_SUFFIX)
+
+PROFILE_1_JRE_LIB_FILES := \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)java$(SHARED_LIBRARY_SUFFIX) \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jsig$(SHARED_LIBRARY_SUFFIX) \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jsig.diz \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)net$(SHARED_LIBRARY_SUFFIX) \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)nio$(SHARED_LIBRARY_SUFFIX) \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)npt$(SHARED_LIBRARY_SUFFIX) \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)npt.diz \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)unpack$(SHARED_LIBRARY_SUFFIX) \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)verify$(SHARED_LIBRARY_SUFFIX) \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)verify.diz \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)zip$(SHARED_LIBRARY_SUFFIX) \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/client/$(LIBRARY_PREFIX)jsig$(SHARED_LIBRARY_SUFFIX) \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/client/$(LIBRARY_PREFIX)jsig.diz \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/client/$(LIBRARY_PREFIX)jvm$(SHARED_LIBRARY_SUFFIX) \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/client/$(LIBRARY_PREFIX)jvm.diz \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/client/Xusage.txt \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/jli/$(LIBRARY_PREFIX)jli$(SHARED_LIBRARY_SUFFIX) \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/jvm.cfg \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/minimal/$(LIBRARY_PREFIX)jsig$(SHARED_LIBRARY_SUFFIX) \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/minimal/$(LIBRARY_PREFIX)jsig.diz \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/minimal/$(LIBRARY_PREFIX)jvm$(SHARED_LIBRARY_SUFFIX) \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/minimal/$(LIBRARY_PREFIX)jvm.diz \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/minimal/Xusage.txt \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/server/$(LIBRARY_PREFIX)jsig$(SHARED_LIBRARY_SUFFIX) \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/server/$(LIBRARY_PREFIX)jsig.diz \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/server/$(LIBRARY_PREFIX)jvm$(SHARED_LIBRARY_SUFFIX) \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/server/$(LIBRARY_PREFIX)jvm.diz \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/server/Xusage.txt \
+    calendars.properties \
+    classlist \
+    content-types.properties \
+    currency.data \
+    ext/localedata.jar \
+    ext/meta-index \
+    ext/sunjce_provider.jar \
+    jce.jar \
+    jsse.jar \
+    logging.properties \
+    meta-index \
+    net.properties \
+    resources.jar \
+    rt.jar \
+    security/US_export_policy.jar \
+    security/blacklist \
+    security/cacerts \
+    security/java.policy \
+    security/java.security \
+    security/local_policy.jar \
+    security/trusted.libraries \
+    tzdb.jar
+
+PROFILE_1_JRE_OTHER_FILES := \
+    COPYRIGHT \
+    LICENSE \
+    README \
+    THIRDPARTYLICENSEREADME.txt \
+    Welcome.html \
+    release
+
+PROFILE_1_JRE_JAR_FILES := \
+    ext/localedata.jar \
+    ext/sunjce_provider.jar \
+    jce.jar \
+    jsse.jar \
+    resources.jar \
+    rt.jar \
+    security/US_export_policy.jar \
+    security/local_policy.jar \
+    tzdb.jar
+
+
+PROFILE_2_JRE_BIN_FILES := \
+    rmid$(EXE_SUFFIX) \
+    rmiregistry$(EXE_SUFFIX)
+
+PROFILE_2_JRE_LIB_FILES := 
+
+PROFILE_2_JRE_OTHER_FILES := 
+
+PROFILE_2_JRE_JAR_FILES := 
+
+
+PROFILE_3_JRE_BIN_FILES := 
+
+PROFILE_3_JRE_LIB_FILES := \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)hprof$(SHARED_LIBRARY_SUFFIX) \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)hprof.diz \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)instrument$(SHARED_LIBRARY_SUFFIX) \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)instrument.diz \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)j2gss$(SHARED_LIBRARY_SUFFIX) \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)j2pcsc$(SHARED_LIBRARY_SUFFIX) \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jaas_unix$(SHARED_LIBRARY_SUFFIX) \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)java_crw_demo$(SHARED_LIBRARY_SUFFIX) \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)java_crw_demo.diz \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jfr$(SHARED_LIBRARY_SUFFIX) \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jsdt$(SHARED_LIBRARY_SUFFIX) \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jsdt.diz \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)management$(SHARED_LIBRARY_SUFFIX) \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)management.diz \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)sctp$(SHARED_LIBRARY_SUFFIX) \
+    jfr.jar \
+    jvm.hprof.txt \
+    management-agent.jar \
+    management/jmxremote.access \
+    management/jmxremote.password.template \
+    management/management.properties \
+    management/snmp.acl.template
+
+PROFILE_3_JRE_OTHER_FILES := 
+
+PROFILE_3_JRE_JAR_FILES := \
+    jfr.jar \
+    management-agent.jar
+
+
+PROFILE_4_JRE_BIN_FILES := \
+    orbd$(EXE_SUFFIX) \
+    pack200$(EXE_SUFFIX) \
+    policytool$(EXE_SUFFIX) \
+    servertool$(EXE_SUFFIX) \
+    tnameserv$(EXE_SUFFIX) \
+    unpack200$(EXE_SUFFIX)
+
+PROFILE_4_JRE_LIB_FILES := \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)awt$(SHARED_LIBRARY_SUFFIX) \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)awt_headless$(SHARED_LIBRARY_SUFFIX) \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)awt_xawt$(SHARED_LIBRARY_SUFFIX) \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)dcpr$(SHARED_LIBRARY_SUFFIX) \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)dt_socket$(SHARED_LIBRARY_SUFFIX) \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)dt_socket.diz \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)fontmanager$(SHARED_LIBRARY_SUFFIX) \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)j2pkcs11$(SHARED_LIBRARY_SUFFIX) \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jawt$(SHARED_LIBRARY_SUFFIX) \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jdwp$(SHARED_LIBRARY_SUFFIX) \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jpeg$(SHARED_LIBRARY_SUFFIX) \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jsound$(SHARED_LIBRARY_SUFFIX) \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jsoundalsa$(SHARED_LIBRARY_SUFFIX) \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)kcms$(SHARED_LIBRARY_SUFFIX) \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)mlib_image$(SHARED_LIBRARY_SUFFIX) \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)splashscreen$(SHARED_LIBRARY_SUFFIX) \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)sunec$(SHARED_LIBRARY_SUFFIX) \
+    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)t2k$(SHARED_LIBRARY_SUFFIX) \
+    alt-rt.jar \
+    charsets.jar \
+    cmm/CIEXYZ.pf \
+    cmm/GRAY.pf \
+    cmm/LINEAR_RGB.pf \
+    cmm/PYCC.pf \
+    cmm/sRGB.pf \
+    ext/cldrdata.jar \
+    ext/dnsns.jar \
+    ext/sunec.jar \
+    ext/sunpkcs11.jar \
+    ext/zipfs.jar \
+    flavormap.properties \
+    fontconfig.RedHat.5.bfc \
+    fontconfig.RedHat.5.properties.src \
+    fontconfig.RedHat.6.bfc \
+    fontconfig.RedHat.6.properties.src \
+    fontconfig.SuSE.10.bfc \
+    fontconfig.SuSE.10.properties.src \
+    fontconfig.SuSE.11.bfc \
+    fontconfig.SuSE.11.properties.src \
+    fontconfig.Turbo.bfc \
+    fontconfig.Turbo.properties.src \
+    fontconfig.bfc \
+    fontconfig.properties.src \
+    fonts/LucidaBrightDemiBold.ttf \
+    fonts/LucidaBrightDemiItalic.ttf \
+    fonts/LucidaBrightItalic.ttf \
+    fonts/LucidaBrightRegular.ttf \
+    fonts/LucidaSansDemiBold.ttf \
+    fonts/LucidaSansRegular.ttf \
+    fonts/LucidaTypewriterBold.ttf \
+    fonts/LucidaTypewriterRegular.ttf \
+    fonts/fonts.dir \
+    images/cursors/cursors.properties \
+    images/cursors/invalid32x32.gif \
+    images/cursors/motif_CopyDrop32x32.gif \
+    images/cursors/motif_CopyNoDrop32x32.gif \
+    images/cursors/motif_LinkDrop32x32.gif \
+    images/cursors/motif_LinkNoDrop32x32.gif \
+    images/cursors/motif_MoveDrop32x32.gif \
+    images/cursors/motif_MoveNoDrop32x32.gif \
+    jexec \
+    oblique-fonts/LucidaSansDemiOblique.ttf \
+    oblique-fonts/LucidaSansOblique.ttf \
+    oblique-fonts/LucidaTypewriterBoldOblique.ttf \
+    oblique-fonts/LucidaTypewriterOblique.ttf \
+    oblique-fonts/fonts.dir \
+    psfont.properties.ja \
+    psfontj2d.properties \
+    servicetag/jdk_header.png \
+    sound.properties
+
+PROFILE_4_JRE_OTHER_FILES := \
+    man/ja_JP.UTF-8/man1/java.1 \
+    man/ja_JP.UTF-8/man1/javaws.1 \
+    man/ja_JP.UTF-8/man1/keytool.1 \
+    man/ja_JP.UTF-8/man1/orbd.1 \
+    man/ja_JP.UTF-8/man1/pack200.1 \
+    man/ja_JP.UTF-8/man1/policytool.1 \
+    man/ja_JP.UTF-8/man1/rmid.1 \
+    man/ja_JP.UTF-8/man1/rmiregistry.1 \
+    man/ja_JP.UTF-8/man1/servertool.1 \
+    man/ja_JP.UTF-8/man1/tnameserv.1 \
+    man/ja_JP.UTF-8/man1/unpack200.1 \
+    man/man1/java.1 \
+    man/man1/javaws.1 \
+    man/man1/keytool.1 \
+    man/man1/orbd.1 \
+    man/man1/pack200.1 \
+    man/man1/policytool.1 \
+    man/man1/rmid.1 \
+    man/man1/rmiregistry.1 \
+    man/man1/servertool.1 \
+    man/man1/tnameserv.1 \
+    man/man1/unpack200.1
+
+PROFILE_4_JRE_JAR_FILES := \
+    alt-rt.jar \
+    charsets.jar \
+    ext/cldrdata.jar \
+    ext/dnsns.jar \
+    ext/sunec.jar \
+    ext/sunpkcs11.jar \
+    ext/zipfs.jar
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/makefiles/profile-rtjar-includes.txt	Tue Feb 26 12:54:39 2013 +0400
@@ -0,0 +1,926 @@
+#
+# Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+PROFILE_1_RTJAR_INCLUDE_PACKAGES := \
+    com/sun/demo/jvmti/hprof \
+    com/sun/java/util/jar/pack \
+    com/sun/net/ssl \
+    com/sun/net/ssl/internal/www/protocol/https \
+    com/sun/nio/file \
+    com/sun/security/cert/internal/x509 \
+    java/io \
+    java/lang \
+    java/lang/annotation \
+    java/lang/invoke \
+    java/lang/ref \
+    java/lang/reflect \
+    java/math \
+    java/net \
+    java/nio \
+    java/nio/channels \
+    java/nio/channels/spi \
+    java/nio/charset \
+    java/nio/charset/spi \
+    java/nio/file \
+    java/nio/file/attribute \
+    java/nio/file/spi \
+    java/security \
+    java/security/cert \
+    java/security/interfaces \
+    java/security/spec \
+    java/text \
+    java/text/spi \
+    java/time \
+    java/util \
+    java/util/concurrent \
+    java/util/concurrent/atomic \
+    java/util/concurrent/locks \
+    java/util/function \
+    java/util/jar \
+    java/util/logging \
+    java/util/regex \
+    java/util/spi \
+    java/util/zip \
+    javax/net \
+    javax/net/ssl \
+    javax/security/auth \
+    javax/security/auth/callback \
+    javax/security/auth/login \
+    javax/security/auth/spi \
+    javax/security/auth/x500 \
+    javax/security/cert \
+    jdk/internal \
+    sun/invoke \
+    sun/invoke/anon \
+    sun/invoke/empty \
+    sun/invoke/util \
+    sun/launcher \
+    sun/launcher/resources \
+    sun/misc \
+    sun/misc/resources \
+    sun/net/ \
+    sun/net/idn \
+    sun/net/sdp \
+    sun/net/spi \
+    sun/net/spi/nameservice \
+    sun/net/util \
+    sun/net/www \
+    sun/net/www/http \
+    sun/net/www/protocol/file \
+    sun/net/www/protocol/http/ \
+    sun/net/www/protocol/http/logging \
+    sun/net/www/protocol/https \
+    sun/net/www/protocol/jar \
+    sun/nio \
+    sun/nio/ch \
+    sun/nio/cs \
+    sun/nio/fs \
+    sun/reflect \
+    sun/reflect/annotation \
+    sun/reflect/generics/factory \
+    sun/reflect/generics/parser \
+    sun/reflect/generics/reflectiveObjects \
+    sun/reflect/generics/repository \
+    sun/reflect/generics/scope \
+    sun/reflect/generics/tree \
+    sun/reflect/generics/visitor \
+    sun/reflect/misc \
+    sun/security/action \
+    sun/security/ec \
+    sun/security/jca \
+    sun/security/pkcs \
+    sun/security/pkcs10 \
+    sun/security/pkcs12 \
+    sun/security/provider \
+    sun/security/provider/certpath \
+    sun/security/provider/certpath/ssl \
+    sun/security/rsa \
+    sun/security/timestamp \
+    sun/security/tools \
+    sun/security/tools/keytool \
+    sun/security/util \
+    sun/security/validator \
+    sun/security/x509 \
+    sun/text \
+    sun/text/bidi \
+    sun/text/normalizer \
+    sun/text/resources \
+    sun/usagetracker \
+    sun/util \
+    sun/util/calendar \
+    sun/util/locale \
+    sun/util/logging \
+    sun/util/logging/resources \
+    sun/util/resources
+
+PROFILE_1_RTJAR_INCLUDE_TYPES :=
+
+PROFILE_1_RTJAR_EXCLUDE_TYPES := 
+
+PROFILE_1_INCLUDE_METAINF_SERVICES := 
+
+
+PROFILE_2_RTJAR_INCLUDE_PACKAGES := \
+    com/sun/java_cup/internal/runtime \
+    com/sun/net/httpserver \
+    com/sun/net/httpserver/spi \
+    com/sun/org/apache/bcel/internal \
+    com/sun/org/apache/bcel/internal/classfile \
+    com/sun/org/apache/bcel/internal/generic \
+    com/sun/org/apache/bcel/internal/util \
+    com/sun/org/apache/regexp/internal \
+    com/sun/org/apache/xalan/internal \
+    com/sun/org/apache/xalan/internal/extensions \
+    com/sun/org/apache/xalan/internal/lib \
+    com/sun/org/apache/xalan/internal/res \
+    com/sun/org/apache/xalan/internal/templates \
+    com/sun/org/apache/xalan/internal/utils \
+    com/sun/org/apache/xalan/internal/xslt \
+    com/sun/org/apache/xalan/internal/xsltc \
+    com/sun/org/apache/xalan/internal/xsltc/cmdline \
+    com/sun/org/apache/xalan/internal/xsltc/cmdline/getopt \
+    com/sun/org/apache/xalan/internal/xsltc/compiler \
+    com/sun/org/apache/xalan/internal/xsltc/compiler/util \
+    com/sun/org/apache/xalan/internal/xsltc/dom \
+    com/sun/org/apache/xalan/internal/xsltc/runtime \
+    com/sun/org/apache/xalan/internal/xsltc/runtime/output \
+    com/sun/org/apache/xalan/internal/xsltc/trax \
+    com/sun/org/apache/xalan/internal/xsltc/util \
+    com/sun/org/apache/xerces/internal/dom \
+    com/sun/org/apache/xerces/internal/dom/events \
+    com/sun/org/apache/xerces/internal/impl \
+    com/sun/org/apache/xerces/internal/impl/dtd \
+    com/sun/org/apache/xerces/internal/impl/dtd/models \
+    com/sun/org/apache/xerces/internal/impl/dv \
+    com/sun/org/apache/xerces/internal/impl/dv/dtd \
+    com/sun/org/apache/xerces/internal/impl/dv/util \
+    com/sun/org/apache/xerces/internal/impl/dv/xs \
+    com/sun/org/apache/xerces/internal/impl/io \
+    com/sun/org/apache/xerces/internal/impl/msg \
+    com/sun/org/apache/xerces/internal/impl/validation \
+    com/sun/org/apache/xerces/internal/impl/xpath \
+    com/sun/org/apache/xerces/internal/impl/xpath/regex \
+    com/sun/org/apache/xerces/internal/impl/xs \
+    com/sun/org/apache/xerces/internal/impl/xs/identity \
+    com/sun/org/apache/xerces/internal/impl/xs/models \
+    com/sun/org/apache/xerces/internal/impl/xs/opti \
+    com/sun/org/apache/xerces/internal/impl/xs/traversers \
+    com/sun/org/apache/xerces/internal/impl/xs/util \
+    com/sun/org/apache/xerces/internal/jaxp \
+    com/sun/org/apache/xerces/internal/jaxp/datatype \
+    com/sun/org/apache/xerces/internal/jaxp/validation \
+    com/sun/org/apache/xerces/internal/parsers \
+    com/sun/org/apache/xerces/internal/util \
+    com/sun/org/apache/xerces/internal/utils \
+    com/sun/org/apache/xerces/internal/xinclude \
+    com/sun/org/apache/xerces/internal/xni \
+    com/sun/org/apache/xerces/internal/xni/grammars \
+    com/sun/org/apache/xerces/internal/xni/parser \
+    com/sun/org/apache/xerces/internal/xpointer \
+    com/sun/org/apache/xerces/internal/xs \
+    com/sun/org/apache/xerces/internal/xs/datatypes \
+    com/sun/org/apache/xml/internal/dtm \
+    com/sun/org/apache/xml/internal/dtm/ref \
+    com/sun/org/apache/xml/internal/dtm/ref/dom2dtm \
+    com/sun/org/apache/xml/internal/dtm/ref/sax2dtm \
+    com/sun/org/apache/xml/internal/res \
+    com/sun/org/apache/xml/internal/resolver \
+    com/sun/org/apache/xml/internal/resolver/helpers \
+    com/sun/org/apache/xml/internal/resolver/readers \
+    com/sun/org/apache/xml/internal/resolver/tools \
+    com/sun/org/apache/xml/internal/serialize \
+    com/sun/org/apache/xml/internal/serializer \
+    com/sun/org/apache/xml/internal/serializer/utils \
+    com/sun/org/apache/xml/internal/utils \
+    com/sun/org/apache/xml/internal/utils/res \
+    com/sun/org/apache/xpath/internal \
+    com/sun/org/apache/xpath/internal/axes \
+    com/sun/org/apache/xpath/internal/compiler \
+    com/sun/org/apache/xpath/internal/domapi \
+    com/sun/org/apache/xpath/internal/functions \
+    com/sun/org/apache/xpath/internal/jaxp \
+    com/sun/org/apache/xpath/internal/objects \
+    com/sun/org/apache/xpath/internal/operations \
+    com/sun/org/apache/xpath/internal/patterns \
+    com/sun/org/apache/xpath/internal/res \
+    com/sun/rmi/rmid \
+    com/sun/xml/internal/stream/ \
+    com/sun/xml/internal/stream/dtd \
+    com/sun/xml/internal/stream/dtd/nonvalidating \
+    com/sun/xml/internal/stream/events \
+    com/sun/xml/internal/stream/util \
+    com/sun/xml/internal/stream/writers \
+    java/rmi \
+    java/rmi/activation \
+    java/rmi/dgc \
+    java/rmi/registry \
+    java/rmi/server \
+    java/sql \
+    javax/rmi/ssl \
+    javax/sql \
+    javax/transaction \
+    javax/transaction/xa \
+    javax/xml \
+    javax/xml/datatype \
+    javax/xml/namespace \
+    javax/xml/parsers \
+    javax/xml/stream \
+    javax/xml/stream/events \
+    javax/xml/stream/util \
+    javax/xml/transform \
+    javax/xml/transform/dom \
+    javax/xml/transform/sax \
+    javax/xml/transform/stax \
+    javax/xml/transform/stream \
+    javax/xml/validation \
+    javax/xml/xpath \
+    org/w3c/dom \
+    org/w3c/dom/bootstrap \
+    org/w3c/dom/css \
+    org/w3c/dom/events \
+    org/w3c/dom/html \
+    org/w3c/dom/ls \
+    org/w3c/dom/ranges \
+    org/w3c/dom/stylesheets \
+    org/w3c/dom/traversal \
+    org/w3c/dom/views \
+    org/w3c/dom/xpath \
+    org/xml/sax \
+    org/xml/sax/ext \
+    org/xml/sax/helpers \
+    sun/net/httpserver \
+    sun/rmi/log \
+    sun/rmi/registry \
+    sun/rmi/runtime \
+    sun/rmi/server \
+    sun/rmi/transport \
+    sun/rmi/transport/proxy \
+    sun/rmi/transport/tcp \
+    sun/util/xml
+
+PROFILE_2_RTJAR_INCLUDE_TYPES := 
+
+PROFILE_2_RTJAR_EXCLUDE_TYPES := 
+
+PROFILE_2_INCLUDE_METAINF_SERVICES := \
+    META-INF/services/sun.util.spi.XmlPropertiesProvider
+
+
+PROFILE_3_RTJAR_INCLUDE_PACKAGES := \
+    com/sun/jmx/defaults \
+    com/sun/jmx/interceptor \
+    com/sun/jmx/mbeanserver \
+    com/sun/jmx/remote/internal \
+    com/sun/jmx/remote/protocol/rmi \
+    com/sun/jmx/remote/security \
+    com/sun/jmx/remote/util \
+    com/sun/jmx/snmp \
+    com/sun/jmx/snmp/IPAcl \
+    com/sun/jmx/snmp/agent \
+    com/sun/jmx/snmp/daemon \
+    com/sun/jmx/snmp/defaults \
+    com/sun/jmx/snmp/internal \
+    com/sun/jmx/snmp/mpm \
+    com/sun/jmx/snmp/tasks \
+    com/sun/jmx/trace \
+    com/sun/jndi/dns \
+    com/sun/jndi/ldap \
+    com/sun/jndi/ldap/ext \
+    com/sun/jndi/ldap/pool \
+    com/sun/jndi/ldap/sasl \
+    com/sun/jndi/rmi/registry \
+    com/sun/jndi/toolkit/ctx \
+    com/sun/jndi/toolkit/dir \
+    com/sun/jndi/toolkit/url \
+    com/sun/jndi/url/dns \
+    com/sun/jndi/url/ldap \
+    com/sun/jndi/url/ldaps \
+    com/sun/jndi/url/rmi \
+    com/sun/management \
+    com/sun/management/jmx \
+    com/sun/naming/internal \
+    com/sun/nio/sctp \
+    com/sun/org/apache/xml/internal/security \
+    com/sun/org/apache/xml/internal/security/algorithms \
+    com/sun/org/apache/xml/internal/security/algorithms/implementations \
+    com/sun/org/apache/xml/internal/security/c14n \
+    com/sun/org/apache/xml/internal/security/c14n/helper \
+    com/sun/org/apache/xml/internal/security/c14n/implementations \
+    com/sun/org/apache/xml/internal/security/encryption \
+    com/sun/org/apache/xml/internal/security/exceptions \
+    com/sun/org/apache/xml/internal/security/keys \
+    com/sun/org/apache/xml/internal/security/keys/content \
+    com/sun/org/apache/xml/internal/security/keys/content/keyvalues \
+    com/sun/org/apache/xml/internal/security/keys/content/x509 \
+    com/sun/org/apache/xml/internal/security/keys/keyresolver \
+    com/sun/org/apache/xml/internal/security/keys/keyresolver/implementations \
+    com/sun/org/apache/xml/internal/security/keys/storage \
+    com/sun/org/apache/xml/internal/security/keys/storage/implementations \
+    com/sun/org/apache/xml/internal/security/signature \
+    com/sun/org/apache/xml/internal/security/transforms \
+    com/sun/org/apache/xml/internal/security/transforms/implementations \
+    com/sun/org/apache/xml/internal/security/transforms/params \
+    com/sun/org/apache/xml/internal/security/utils \
+    com/sun/org/apache/xml/internal/security/utils/resolver \
+    com/sun/org/apache/xml/internal/security/utils/resolver/implementations \
+    com/sun/rowset \
+    com/sun/rowset/internal \
+    com/sun/rowset/providers \
+    com/sun/script/javascript \
+    com/sun/script/util \
+    com/sun/security/auth/callback \
+    com/sun/security/auth/login \
+    com/sun/security/auth/module \
+    com/sun/security/jgss \
+    com/sun/security/ntlm \
+    com/sun/security/sasl \
+    com/sun/security/sasl/digest \
+    com/sun/security/sasl/gsskerb \
+    com/sun/security/sasl/ntlm \
+    com/sun/security/sasl/util \
+    com/sun/tracing \
+    com/sun/tracing/dtrace \
+    java/lang/instrument \
+    java/lang/management \
+    java/security/acl \
+    java/util/prefs \
+    javax/annotation/processing \
+    javax/lang/model \
+    javax/lang/model/element \
+    javax/lang/model/type \
+    javax/lang/model/util \
+    javax/management \
+    javax/management/loading \
+    javax/management/modelmbean \
+    javax/management/monitor \
+    javax/management/openmbean \
+    javax/management/relation \
+    javax/management/remote \
+    javax/management/remote/rmi \
+    javax/management/timer \
+    javax/naming \
+    javax/naming/directory \
+    javax/naming/event \
+    javax/naming/ldap \
+    javax/naming/spi \
+    javax/script \
+    javax/security/auth/kerberos \
+    javax/security/sasl \
+    javax/smartcardio \
+    javax/sql/rowset \
+    javax/sql/rowset/serial \
+    javax/sql/rowset/spi \
+    javax/tools \
+    javax/tools/annotation \
+    javax/xml/crypto \
+    javax/xml/crypto/dom \
+    javax/xml/crypto/dsig \
+    javax/xml/crypto/dsig/dom \
+    javax/xml/crypto/dsig/keyinfo \
+    javax/xml/crypto/dsig/spec \
+    org/ietf/jgss \
+    org/jcp/xml/dsig/internal \
+    org/jcp/xml/dsig/internal/dom \
+    sun/instrument \
+    sun/management \
+    sun/management/counter \
+    sun/management/counter/perf \
+    sun/management/jmxremote \
+    sun/management/resources \
+    sun/management/snmp \
+    sun/management/snmp/jvminstr \
+    sun/management/snmp/jvmmib \
+    sun/management/snmp/util \
+    sun/net/dns \
+    sun/net/www/protocol/http/ntlm \
+    sun/net/www/protocol/http/spnego \
+    sun/nio/ch/sctp \
+    sun/org/mozilla/classfile/internal \
+    sun/org/mozilla/javascript/internal \
+    sun/org/mozilla/javascript/internal/annotations \
+    sun/org/mozilla/javascript/internal/ast \
+    sun/org/mozilla/javascript/internal/debug \
+    sun/org/mozilla/javascript/internal/jdk13 \
+    sun/org/mozilla/javascript/internal/jdk15 \
+    sun/org/mozilla/javascript/internal/json \
+    sun/org/mozilla/javascript/internal/optimizer \
+    sun/org/mozilla/javascript/internal/regexp \
+    sun/org/mozilla/javascript/internal/serialize \
+    sun/org/mozilla/javascript/internal/xml \
+    sun/org/mozilla/javascript/internal/xmlimpl \
+    sun/security/acl \
+    sun/security/jgss \
+    sun/security/jgss/krb5 \
+    sun/security/jgss/spi \
+    sun/security/jgss/spnego \
+    sun/security/jgss/wrapper \
+    sun/security/krb5 \
+    sun/security/krb5/internal \
+    sun/security/krb5/internal/ccache \
+    sun/security/krb5/internal/crypto \
+    sun/security/krb5/internal/crypto/dk \
+    sun/security/krb5/internal/ktab \
+    sun/security/krb5/internal/rcache \
+    sun/security/krb5/internal/util \
+    sun/security/provider/certpath/ldap \
+    sun/security/smartcardio \
+    sun/tracing \
+    sun/tracing/dtrace
+
+PROFILE_3_RTJAR_INCLUDE_TYPES := \
+    com/sun/security/auth/*.class
+
+PROFILE_3_RTJAR_EXCLUDE_TYPES := \
+    javax/management/remote/rmi/_RMIConnectionImpl_Tie.class \
+    javax/management/remote/rmi/_RMIConnection_Stub.class \
+    javax/management/remote/rmi/_RMIServerImpl_Tie.class \
+    javax/management/remote/rmi/_RMIServer_Stub.class \
+    com/sun/security/auth/callback/DialogCallbackHandler.class \
+    com/sun/security/auth/callback/DialogCallbackHandler\$$$$1.class \
+    com/sun/security/auth/callback/DialogCallbackHandler\$$$$2.class \
+    com/sun/security/auth/callback/DialogCallbackHandler\$$$$Action.class \
+    com/sun/security/auth/callback/DialogCallbackHandler\$$$$ConfirmationInfo.class
+
+PROFILE_3_INCLUDE_METAINF_SERVICES := \
+    META-INF/services/javax.script.ScriptEngineFactory 
+
+
+PROFILE_4_RTJAR_INCLUDE_PACKAGES := \
+    com/oracle/net \
+    com/oracle/nio \
+    com/oracle/util \
+    com/sun/accessibility/internal/resources \
+    com/sun/activation/registries \
+    com/sun/awt \
+    com/sun/beans \
+    com/sun/beans/decoder \
+    com/sun/beans/finder \
+    com/sun/corba/se/impl/activation \
+    com/sun/corba/se/impl/copyobject \
+    com/sun/corba/se/impl/corba \
+    com/sun/corba/se/impl/dynamicany \
+    com/sun/corba/se/impl/encoding \
+    com/sun/corba/se/impl/interceptors \
+    com/sun/corba/se/impl/io \
+    com/sun/corba/se/impl/ior \
+    com/sun/corba/se/impl/ior/iiop \
+    com/sun/corba/se/impl/javax/rmi \
+    com/sun/corba/se/impl/javax/rmi/CORBA \
+    com/sun/corba/se/impl/legacy/connection \
+    com/sun/corba/se/impl/logging \
+    com/sun/corba/se/impl/monitoring \
+    com/sun/corba/se/impl/naming/cosnaming \
+    com/sun/corba/se/impl/naming/namingutil \
+    com/sun/corba/se/impl/naming/pcosnaming \
+    com/sun/corba/se/impl/oa \
+    com/sun/corba/se/impl/oa/poa \
+    com/sun/corba/se/impl/oa/toa \
+    com/sun/corba/se/impl/orb \
+    com/sun/corba/se/impl/orbutil \
+    com/sun/corba/se/impl/orbutil/closure \
+    com/sun/corba/se/impl/orbutil/concurrent \
+    com/sun/corba/se/impl/orbutil/fsm \
+    com/sun/corba/se/impl/orbutil/graph \
+    com/sun/corba/se/impl/orbutil/threadpool \
+    com/sun/corba/se/impl/presentation/rmi \
+    com/sun/corba/se/impl/protocol \
+    com/sun/corba/se/impl/protocol/giopmsgheaders \
+    com/sun/corba/se/impl/resolver \
+    com/sun/corba/se/impl/transport \
+    com/sun/corba/se/impl/util \
+    com/sun/corba/se/internal/CosNaming \
+    com/sun/corba/se/internal/Interceptors \
+    com/sun/corba/se/internal/POA \
+    com/sun/corba/se/internal/corba \
+    com/sun/corba/se/internal/iiop \
+    com/sun/corba/se/org/omg/CORBA \
+    com/sun/corba/se/pept/broker \
+    com/sun/corba/se/pept/encoding \
+    com/sun/corba/se/pept/protocol \
+    com/sun/corba/se/pept/transport \
+    com/sun/corba/se/spi/activation \
+    com/sun/corba/se/spi/activation/InitialNameServicePackage \
+    com/sun/corba/se/spi/activation/LocatorPackage \
+    com/sun/corba/se/spi/activation/RepositoryPackage \
+    com/sun/corba/se/spi/copyobject \
+    com/sun/corba/se/spi/encoding \
+    com/sun/corba/se/spi/extension \
+    com/sun/corba/se/spi/ior \
+    com/sun/corba/se/spi/ior/iiop \
+    com/sun/corba/se/spi/legacy/connection \
+    com/sun/corba/se/spi/legacy/interceptor \
+    com/sun/corba/se/spi/logging \
+    com/sun/corba/se/spi/monitoring \
+    com/sun/corba/se/spi/oa \
+    com/sun/corba/se/spi/orb \
+    com/sun/corba/se/spi/orbutil/closure \
+    com/sun/corba/se/spi/orbutil/fsm \
+    com/sun/corba/se/spi/orbutil/proxy \
+    com/sun/corba/se/spi/orbutil/threadpool \
+    com/sun/corba/se/spi/presentation/rmi \
+    com/sun/corba/se/spi/protocol \
+    com/sun/corba/se/spi/resolver \
+    com/sun/corba/se/spi/servicecontext \
+    com/sun/corba/se/spi/transport \
+    com/sun/image/codec/jpeg \
+    com/sun/imageio/plugins/bmp \
+    com/sun/imageio/plugins/common \
+    com/sun/imageio/plugins/gif \
+    com/sun/imageio/plugins/jpeg \
+    com/sun/imageio/plugins/png \
+    com/sun/imageio/plugins/wbmp \
+    com/sun/imageio/spi \
+    com/sun/imageio/stream \
+    com/sun/istack/internal \
+    com/sun/istack/internal/localization \
+    com/sun/istack/internal/logging \
+    com/sun/java/browser/dom \
+    com/sun/java/browser/net \
+    com/sun/java/swing \
+    com/sun/java/swing/plaf/gtk \
+    com/sun/java/swing/plaf/gtk/resources \
+    com/sun/java/swing/plaf/motif \
+    com/sun/java/swing/plaf/motif/resources \
+    com/sun/java/swing/plaf/nimbus \
+    com/sun/java/swing/plaf/windows \
+    com/sun/java/swing/plaf/windows/resources \
+    com/sun/jmx/remote/protocol/iiop \
+    com/sun/jndi/cosnaming \
+    com/sun/jndi/toolkit/corba \
+    com/sun/jndi/url/corbaname \
+    com/sun/jndi/url/iiop \
+    com/sun/jndi/url/iiopname \
+    com/sun/media/sound \
+    com/sun/org/glassfish/external/amx \
+    com/sun/org/glassfish/external/arc \
+    com/sun/org/glassfish/external/probe/provider \
+    com/sun/org/glassfish/external/probe/provider/annotations \
+    com/sun/org/glassfish/external/statistics \
+    com/sun/org/glassfish/external/statistics/annotations \
+    com/sun/org/glassfish/external/statistics/impl \
+    com/sun/org/glassfish/gmbal \
+    com/sun/org/glassfish/gmbal/util \
+    com/sun/org/omg/CORBA \
+    com/sun/org/omg/CORBA/ValueDefPackage \
+    com/sun/org/omg/CORBA/portable \
+    com/sun/org/omg/SendingContext \
+    com/sun/org/omg/SendingContext/CodeBasePackage \
+    com/sun/servicetag \
+    com/sun/swing/internal/plaf/basic/resources \
+    com/sun/swing/internal/plaf/metal/resources \
+    com/sun/swing/internal/plaf/synth/resources \
+    com/sun/xml/internal/bind \
+    com/sun/xml/internal/bind/annotation \
+    com/sun/xml/internal/bind/api \
+    com/sun/xml/internal/bind/api/impl \
+    com/sun/xml/internal/bind/marshaller \
+    com/sun/xml/internal/bind/unmarshaller \
+    com/sun/xml/internal/bind/util \
+    com/sun/xml/internal/bind/v2 \
+    com/sun/xml/internal/bind/v2/bytecode \
+    com/sun/xml/internal/bind/v2/model/annotation \
+    com/sun/xml/internal/bind/v2/model/core \
+    com/sun/xml/internal/bind/v2/model/impl \
+    com/sun/xml/internal/bind/v2/model/nav \
+    com/sun/xml/internal/bind/v2/model/runtime \
+    com/sun/xml/internal/bind/v2/runtime \
+    com/sun/xml/internal/bind/v2/runtime/output \
+    com/sun/xml/internal/bind/v2/runtime/property \
+    com/sun/xml/internal/bind/v2/runtime/reflect \
+    com/sun/xml/internal/bind/v2/runtime/reflect/opt \
+    com/sun/xml/internal/bind/v2/runtime/unmarshaller \
+    com/sun/xml/internal/bind/v2/schemagen \
+    com/sun/xml/internal/bind/v2/schemagen/episode \
+    com/sun/xml/internal/bind/v2/schemagen/xmlschema \
+    com/sun/xml/internal/bind/v2/util \
+    com/sun/xml/internal/fastinfoset \
+    com/sun/xml/internal/fastinfoset/algorithm \
+    com/sun/xml/internal/fastinfoset/alphabet \
+    com/sun/xml/internal/fastinfoset/dom \
+    com/sun/xml/internal/fastinfoset/org/apache/xerces/util \
+    com/sun/xml/internal/fastinfoset/sax \
+    com/sun/xml/internal/fastinfoset/stax \
+    com/sun/xml/internal/fastinfoset/stax/events \
+    com/sun/xml/internal/fastinfoset/stax/factory \
+    com/sun/xml/internal/fastinfoset/stax/util \
+    com/sun/xml/internal/fastinfoset/tools \
+    com/sun/xml/internal/fastinfoset/util \
+    com/sun/xml/internal/fastinfoset/vocab \
+    com/sun/xml/internal/messaging/saaj \
+    com/sun/xml/internal/messaging/saaj/client/p2p \
+    com/sun/xml/internal/messaging/saaj/packaging/mime \
+    com/sun/xml/internal/messaging/saaj/packaging/mime/internet \
+    com/sun/xml/internal/messaging/saaj/packaging/mime/util \
+    com/sun/xml/internal/messaging/saaj/soap \
+    com/sun/xml/internal/messaging/saaj/soap/dynamic \
+    com/sun/xml/internal/messaging/saaj/soap/impl \
+    com/sun/xml/internal/messaging/saaj/soap/name \
+    com/sun/xml/internal/messaging/saaj/soap/ver1_1 \
+    com/sun/xml/internal/messaging/saaj/soap/ver1_2 \
+    com/sun/xml/internal/messaging/saaj/util \
+    com/sun/xml/internal/messaging/saaj/util/transform \
+    com/sun/xml/internal/org/jvnet/fastinfoset \
+    com/sun/xml/internal/org/jvnet/fastinfoset/sax \
+    com/sun/xml/internal/org/jvnet/fastinfoset/sax/helpers \
+    com/sun/xml/internal/org/jvnet/fastinfoset/stax \
+    com/sun/xml/internal/org/jvnet/mimepull \
+    com/sun/xml/internal/org/jvnet/staxex \
+    com/sun/xml/internal/org/jvnet/ws \
+    com/sun/xml/internal/org/jvnet/ws/databinding \
+    com/sun/xml/internal/org/jvnet/ws/message \
+    com/sun/xml/internal/stream/buffer \
+    com/sun/xml/internal/stream/buffer/sax \
+    com/sun/xml/internal/stream/buffer/stax \
+    com/sun/xml/internal/txw2 \
+    com/sun/xml/internal/txw2/annotation \
+    com/sun/xml/internal/txw2/output \
+    com/sun/xml/internal/ws/addressing \
+    com/sun/xml/internal/ws/addressing/model \
+    com/sun/xml/internal/ws/addressing/policy \
+    com/sun/xml/internal/ws/addressing/v200408 \
+    com/sun/xml/internal/ws/api \
+    com/sun/xml/internal/ws/api/addressing \
+    com/sun/xml/internal/ws/api/client \
+    com/sun/xml/internal/ws/api/config/management \
+    com/sun/xml/internal/ws/api/config/management/policy \
+    com/sun/xml/internal/ws/api/databinding \
+    com/sun/xml/internal/ws/api/fastinfoset \
+    com/sun/xml/internal/ws/api/ha \
+    com/sun/xml/internal/ws/api/handler \
+    com/sun/xml/internal/ws/api/message \
+    com/sun/xml/internal/ws/api/message/saaj \
+    com/sun/xml/internal/ws/api/message/stream \
+    com/sun/xml/internal/ws/api/model \
+    com/sun/xml/internal/ws/api/model/soap \
+    com/sun/xml/internal/ws/api/model/wsdl \
+    com/sun/xml/internal/ws/api/pipe \
+    com/sun/xml/internal/ws/api/pipe/helper \
+    com/sun/xml/internal/ws/api/policy \
+    com/sun/xml/internal/ws/api/policy/subject \
+    com/sun/xml/internal/ws/api/server \
+    com/sun/xml/internal/ws/api/streaming \
+    com/sun/xml/internal/ws/api/wsdl/parser \
+    com/sun/xml/internal/ws/api/wsdl/writer \
+    com/sun/xml/internal/ws/binding \
+    com/sun/xml/internal/ws/client \
+    com/sun/xml/internal/ws/client/dispatch \
+    com/sun/xml/internal/ws/client/sei \
+    com/sun/xml/internal/ws/config/management/policy \
+    com/sun/xml/internal/ws/db \
+    com/sun/xml/internal/ws/db/glassfish \
+    com/sun/xml/internal/ws/developer \
+    com/sun/xml/internal/ws/encoding \
+    com/sun/xml/internal/ws/encoding/fastinfoset \
+    com/sun/xml/internal/ws/encoding/policy \
+    com/sun/xml/internal/ws/encoding/soap \
+    com/sun/xml/internal/ws/encoding/soap/streaming \
+    com/sun/xml/internal/ws/encoding/xml \
+    com/sun/xml/internal/ws/fault \
+    com/sun/xml/internal/ws/handler \
+    com/sun/xml/internal/ws/message \
+    com/sun/xml/internal/ws/message/jaxb \
+    com/sun/xml/internal/ws/message/saaj \
+    com/sun/xml/internal/ws/message/source \
+    com/sun/xml/internal/ws/message/stream \
+    com/sun/xml/internal/ws/model \
+    com/sun/xml/internal/ws/model/soap \
+    com/sun/xml/internal/ws/model/wsdl \
+    com/sun/xml/internal/ws/org/objectweb/asm \
+    com/sun/xml/internal/ws/policy \
+    com/sun/xml/internal/ws/policy/jaxws \
+    com/sun/xml/internal/ws/policy/jaxws/spi \
+    com/sun/xml/internal/ws/policy/privateutil \
+    com/sun/xml/internal/ws/policy/sourcemodel \
+    com/sun/xml/internal/ws/policy/sourcemodel/attach \
+    com/sun/xml/internal/ws/policy/sourcemodel/wspolicy \
+    com/sun/xml/internal/ws/policy/spi \
+    com/sun/xml/internal/ws/policy/subject \
+    com/sun/xml/internal/ws/protocol/soap \
+    com/sun/xml/internal/ws/protocol/xml \
+    com/sun/xml/internal/ws/resources \
+    com/sun/xml/internal/ws/server \
+    com/sun/xml/internal/ws/server/provider \
+    com/sun/xml/internal/ws/server/sei \
+    com/sun/xml/internal/ws/spi \
+    com/sun/xml/internal/ws/spi/db \
+    com/sun/xml/internal/ws/streaming \
+    com/sun/xml/internal/ws/transport \
+    com/sun/xml/internal/ws/transport/http \
+    com/sun/xml/internal/ws/transport/http/client \
+    com/sun/xml/internal/ws/transport/http/server \
+    com/sun/xml/internal/ws/util \
+    com/sun/xml/internal/ws/util/exception \
+    com/sun/xml/internal/ws/util/localization \
+    com/sun/xml/internal/ws/util/pipe \
+    com/sun/xml/internal/ws/util/xml \
+    com/sun/xml/internal/ws/wsdl \
+    com/sun/xml/internal/ws/wsdl/parser \
+    com/sun/xml/internal/ws/wsdl/writer \
+    com/sun/xml/internal/ws/wsdl/writer/document \
+    com/sun/xml/internal/ws/wsdl/writer/document/http \
+    com/sun/xml/internal/ws/wsdl/writer/document/soap \
+    com/sun/xml/internal/ws/wsdl/writer/document/soap12 \
+    com/sun/xml/internal/ws/wsdl/writer/document/xsd \
+    java/applet \
+    java/awt \
+    java/awt/color \
+    java/awt/datatransfer \
+    java/awt/dnd \
+    java/awt/dnd/peer \
+    java/awt/event \
+    java/awt/font \
+    java/awt/geom \
+    java/awt/im \
+    java/awt/im/spi \
+    java/awt/image \
+    java/awt/image/renderable \
+    java/awt/peer \
+    java/awt/print \
+    java/beans \
+    javax/accessibility \
+    javax/activation \
+    javax/activity \
+    javax/imageio \
+    javax/imageio/event \
+    javax/imageio/metadata \
+    javax/imageio/plugins/bmp \
+    javax/imageio/plugins/jpeg \
+    javax/imageio/spi \
+    javax/imageio/stream \
+    javax/jws \
+    javax/jws/soap \
+    javax/print \
+    javax/print/attribute \
+    javax/print/attribute/standard \
+    javax/print/event \
+    javax/rmi/CORBA \
+    javax/sound/midi \
+    javax/sound/midi/spi \
+    javax/sound/sampled \
+    javax/sound/sampled/spi \
+    javax/swing \
+    javax/swing/border \
+    javax/swing/colorchooser \
+    javax/swing/event \
+    javax/swing/filechooser \
+    javax/swing/plaf \
+    javax/swing/plaf/basic \
+    javax/swing/plaf/metal \
+    javax/swing/plaf/multi \
+    javax/swing/plaf/nimbus \
+    javax/swing/plaf/synth \
+    javax/swing/table \
+    javax/swing/text \
+    javax/swing/text/html \
+    javax/swing/text/html/parser \
+    javax/swing/text/rtf \
+    javax/swing/tree \
+    javax/swing/undo \
+    javax/xml/bind \
+    javax/xml/bind/annotation \
+    javax/xml/bind/annotation/adapters \
+    javax/xml/bind/attachment \
+    javax/xml/bind/helpers \
+    javax/xml/bind/util \
+    javax/xml/soap \
+    javax/xml/ws \
+    javax/xml/ws/handler \
+    javax/xml/ws/handler/soap \
+    javax/xml/ws/http \
+    javax/xml/ws/soap \
+    javax/xml/ws/spi \
+    javax/xml/ws/spi/http \
+    javax/xml/ws/wsaddressing \
+    org/omg/CORBA \
+    org/omg/CORBA/DynAnyPackage \
+    org/omg/CORBA/ORBPackage \
+    org/omg/CORBA/TypeCodePackage \
+    org/omg/CORBA/portable \
+    org/omg/CORBA_2_3 \
+    org/omg/CORBA_2_3/portable \
+    org/omg/CosNaming \
+    org/omg/CosNaming/NamingContextExtPackage \
+    org/omg/CosNaming/NamingContextPackage \
+    org/omg/Dynamic \
+    org/omg/DynamicAny \
+    org/omg/DynamicAny/DynAnyFactoryPackage \
+    org/omg/DynamicAny/DynAnyPackage \
+    org/omg/IOP \
+    org/omg/IOP/CodecFactoryPackage \
+    org/omg/IOP/CodecPackage \
+    org/omg/Messaging \
+    org/omg/PortableInterceptor \
+    org/omg/PortableInterceptor/ORBInitInfoPackage \
+    org/omg/PortableServer \
+    org/omg/PortableServer/CurrentPackage \
+    org/omg/PortableServer/POAManagerPackage \
+    org/omg/PortableServer/POAPackage \
+    org/omg/PortableServer/ServantLocatorPackage \
+    org/omg/PortableServer/portable \
+    org/omg/SendingContext \
+    org/omg/stub/java/rmi \
+    org/omg/stub/javax/management/remote/rmi \
+    sun/applet \
+    sun/applet/resources \
+    sun/audio \
+    sun/awt \
+    sun/awt/X11 \
+    sun/awt/datatransfer \
+    sun/awt/dnd \
+    sun/awt/event \
+    sun/awt/geom \
+    sun/awt/im \
+    sun/awt/image \
+    sun/awt/image/codec \
+    sun/awt/motif \
+    sun/awt/resources \
+    sun/awt/shell \
+    sun/awt/util \
+    sun/awt/windows \
+    sun/beans/editors \
+    sun/beans/infos \
+    sun/corba \
+    sun/dc \
+    sun/dc/path \
+    sun/dc/pr \
+    sun/font \
+    sun/java2d \
+    sun/java2d/cmm \
+    sun/java2d/cmm/kcms \
+    sun/java2d/cmm/lcms \
+    sun/java2d/jules \
+    sun/java2d/loops \
+    sun/java2d/opengl \
+    sun/java2d/pipe \
+    sun/java2d/pipe/hw \
+    sun/java2d/pisces \
+    sun/java2d/x11 \
+    sun/java2d/xr \
+    sun/net/ftp \
+    sun/net/ftp/impl \
+    sun/net/smtp \
+    sun/net/www/content/audio \
+    sun/net/www/content/image \
+    sun/net/www/content/text \
+    sun/net/www/protocol/ftp \
+    sun/net/www/protocol/mailto \
+    sun/net/www/protocol/netdoc \
+    sun/print \
+    sun/print/resources \
+    sun/security/tools/policytool \
+    sun/swing \
+    sun/swing/icon \
+    sun/swing/plaf \
+    sun/swing/plaf/synth \
+    sun/swing/plaf/windows \
+    sun/swing/table \
+    sun/swing/text \
+    sun/swing/text/html \
+    sun/tools/jar \
+    sun/tools/jar/resources
+
+PROFILE_4_RTJAR_INCLUDE_TYPES := \
+    com/sun/xml/internal/ws/*.class \
+    javax/annotation/*.class \
+    javax/rmi/*.class
+
+PROFILE_4_RTJAR_EXCLUDE_TYPES := 
+
+PROFILE_4_INCLUDE_METAINF_SERVICES := \
+    META-INF/services/com.sun.tools.internal.ws.wscompile.Plugin  \
+    META-INF/services/com.sun.tools.internal.xjc.Plugin  \
+    META-INF/services/javax.print.PrintServiceLookup  \
+    META-INF/services/javax.print.StreamPrintServiceFactory  \
+    META-INF/services/javax.sound.midi.spi.MidiDeviceProvider  \
+    META-INF/services/javax.sound.midi.spi.MidiFileReader  \
+    META-INF/services/javax.sound.midi.spi.MidiFileWriter  \
+    META-INF/services/javax.sound.midi.spi.SoundbankReader  \
+    META-INF/services/javax.sound.sampled.spi.AudioFileReader  \
+    META-INF/services/javax.sound.sampled.spi.AudioFileWriter  \
+    META-INF/services/javax.sound.sampled.spi.FormatConversionProvider  \
+    META-INF/services/javax.sound.sampled.spi.MixerProvider  \
+    META-INF/services/sun.java2d.cmm.PCMM  \
+    META-INF/services/sun.java2d.pipe.RenderingEngine 
+
+
--- a/src/share/classes/java/net/URLClassLoader.java	Thu Feb 21 17:55:33 2013 -0800
+++ b/src/share/classes/java/net/URLClassLoader.java	Tue Feb 26 12:54:39 2013 +0400
@@ -57,6 +57,12 @@
  * <p>
  * The classes that are loaded are by default granted permission only to
  * access the URLs specified when the URLClassLoader was created.
+ * <p>
+ * Where a JAR file contains the {@link Name#PROFILE Profile} attribute
+ * then its value is the name of the Java SE profile that the library
+ * minimally requires. If this runtime does not support the profile then
+ * it causes {@link java.util.jar.UnsupportedProfileException} to be
+ * thrown at some unspecified time.
  *
  * @author  David Connelly
  * @since   1.2
--- a/src/share/classes/java/util/jar/Attributes.java	Thu Feb 21 17:55:33 2013 -0800
+++ b/src/share/classes/java/util/jar/Attributes.java	Tue Feb 26 12:54:39 2013 +0400
@@ -565,6 +565,15 @@
         public static final Name MAIN_CLASS = new Name("Main-Class");
 
         /**
+         * {@code Name} object for {@code Profile} manifest attribute used by
+         * applications or libraries packaged as JAR files to indicate the
+         * minimum profile required to execute the application.
+         * @since 1.8
+         * @see UnsupportedProfileException
+         */
+        public static final Name PROFILE = new Name("Profile");
+
+        /**
          * <code>Name</code> object for <code>Sealed</code> manifest attribute
          * used for sealing.
          * @see <a href="../../../../technotes/guides/extensions/spec.html#sealing">
--- a/src/share/classes/java/util/jar/Pack200.java	Thu Feb 21 17:55:33 2013 -0800
+++ b/src/share/classes/java/util/jar/Pack200.java	Tue Feb 26 12:54:39 2013 +0400
@@ -574,6 +574,13 @@
          * Registers a listener for PropertyChange events on the properties map.
          * This is typically used by applications to update a progress bar.
          *
+         * <p> The default implementation of this method does nothing and has
+         * no side-effects.</p>
+         *
+         * <p><b>WARNING:</b> This method is omitted from the interface
+         * declaration in all subset Profiles of Java SE that do not include
+         * the {@code java.beans} package. </p>
+
          * @see #properties
          * @see #PROGRESS
          * @param listener  An object to be invoked when a property is changed.
@@ -586,12 +593,20 @@
          *             property instead.
          */
         @Deprecated
-        void addPropertyChangeListener(PropertyChangeListener listener) ;
+        default void addPropertyChangeListener(PropertyChangeListener listener) {
+        }
 
         /**
          * Remove a listener for PropertyChange events, added by
          * the {@link #addPropertyChangeListener}.
          *
+         * <p> The default implementation of this method does nothing and has
+         * no side-effects.</p>
+         *
+         * <p><b>WARNING:</b> This method is omitted from the interface
+         * declaration in all subset Profiles of Java SE that do not include
+         * the {@code java.beans} package. </p>
+         *
          * @see #addPropertyChangeListener
          * @param listener  The PropertyChange listener to be removed.
          * @deprecated The dependency on {@code PropertyChangeListener} creates
@@ -600,8 +615,8 @@
          *             release.
          */
         @Deprecated
-        void removePropertyChangeListener(PropertyChangeListener listener);
-
+        default void removePropertyChangeListener(PropertyChangeListener listener) {
+        }
     }
 
     /**
@@ -718,6 +733,13 @@
          * Registers a listener for PropertyChange events on the properties map.
          * This is typically used by applications to update a progress bar.
          *
+         * <p> The default implementation of this method does nothing and has
+         * no side-effects.</p>
+         *
+         * <p><b>WARNING:</b> This method is omitted from the interface
+         * declaration in all subset Profiles of Java SE that do not include
+         * the {@code java.beans} package. </p>
+         *
          * @see #properties
          * @see #PROGRESS
          * @param listener  An object to be invoked when a property is changed.
@@ -730,12 +752,20 @@
          *             PROGRESS} property instead.
          */
         @Deprecated
-        void addPropertyChangeListener(PropertyChangeListener listener) ;
+        default void addPropertyChangeListener(PropertyChangeListener listener) {
+        }
 
         /**
          * Remove a listener for PropertyChange events, added by
          * the {@link #addPropertyChangeListener}.
          *
+         * <p> The default implementation of this method does nothing and has
+         * no side-effects.</p>
+         *
+         * <p><b>WARNING:</b> This method is omitted from the interface
+         * declaration in all subset Profiles of Java SE that do not include
+         * the {@code java.beans} package. </p>
+         *
          * @see #addPropertyChangeListener
          * @param listener  The PropertyChange listener to be removed.
          * @deprecated The dependency on {@code PropertyChangeListener} creates
@@ -744,7 +774,8 @@
          *             release.
          */
         @Deprecated
-        void removePropertyChangeListener(PropertyChangeListener listener);
+        default void removePropertyChangeListener(PropertyChangeListener listener) {
+        }
     }
 
     // Private stuff....
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/java/util/jar/UnsupportedProfileException.java	Tue Feb 26 12:54:39 2013 +0400
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.util.jar;
+
+/**
+ * Thrown to indicate an attempt to access a JAR file with a {@link
+ * Attributes.Name#PROFILE Profile} attribute that names a profile that
+ * is not supported by this runtime.
+ *
+ * @since   1.8
+ */
+public class UnsupportedProfileException extends RuntimeException {
+    private static final long serialVersionUID = -1834773870678792406L;
+
+    /**
+     * Constructs an {@code UnsupportedProfileException} with no detail
+     * message.
+     */
+    public UnsupportedProfileException() {
+    }
+
+    /**
+     * Constructs an {@code UnsupportedProfileException} with the
+     * specified detail message.
+     *
+     * @param message the detail message
+     */
+    public UnsupportedProfileException(String message) {
+        super(message);
+    }
+}
--- a/src/share/classes/java/util/logging/LogManager.java	Thu Feb 21 17:55:33 2013 -0800
+++ b/src/share/classes/java/util/logging/LogManager.java	Tue Feb 26 12:54:39 2013 +0400
@@ -302,6 +302,10 @@
      * the same event Listener results in multiple entries
      * in the property event listener table.
      *
+     * <p><b>WARNING:</b> This method is omitted from this class in all subset
+     * Profiles of Java SE that do not include the {@code java.beans} package.
+     * </p>
+     *
      * @param l  event listener
      * @exception  SecurityException  if a security manager exists and if
      *             the caller does not have LoggingPermission("control").
@@ -335,6 +339,10 @@
      * <P>
      * Returns silently if the given listener is not found.
      *
+     * <p><b>WARNING:</b> This method is omitted from this class in all subset
+     * Profiles of Java SE that do not include the {@code java.beans} package.
+     * </p>
+     *
      * @param l  event listener (can be null)
      * @exception  SecurityException  if a security manager exists and if
      *             the caller does not have LoggingPermission("control").
--- a/src/share/classes/sun/launcher/LauncherHelper.java	Thu Feb 21 17:55:33 2013 -0800
+++ b/src/share/classes/sun/launcher/LauncherHelper.java	Tue Feb 26 12:54:39 2013 +0400
@@ -65,10 +65,14 @@
 import java.util.jar.Attributes;
 import java.util.jar.JarFile;
 import java.util.jar.Manifest;
+import sun.misc.Version;
+import sun.misc.URLClassPath;
 
 public enum LauncherHelper {
     INSTANCE;
     private static final String MAIN_CLASS = "Main-Class";
+    private static final String PROFILE    = "Profile";
+
     private static StringBuilder outBuf = new StringBuilder();
 
     private static final String INDENT = "    ";
@@ -409,6 +413,28 @@
             if (mainValue == null) {
                 abort(null, "java.launcher.jar.error3", jarname);
             }
+
+            /*
+             * If this is not a full JRE then the Profile attribute must be
+             * present with the Main-Class attribute so as to indicate the minimum
+             * profile required. Note that we need to suppress checking of the Profile
+             * attribute after we detect an error. This is because the abort may
+             * need to lookup resources and this may involve opening additional JAR
+             * files that would result in errors that suppress the main error.
+             */
+            String profile = mainAttrs.getValue(PROFILE);
+            if (profile == null) {
+                if (!Version.isFullJre()) {
+                    URLClassPath.suppressProfileCheckForLauncher();
+                    abort(null, "java.launcher.jar.error4", jarname);
+                }
+            } else {
+                if (!Version.supportsProfile(profile)) {
+                    URLClassPath.suppressProfileCheckForLauncher();
+                    abort(null, "java.launcher.jar.error5", profile, jarname);
+                }
+            }
+
             /*
              * Hand off to FXHelper if it detects a JavaFX application
              * This must be done after ensuring a Main-Class entry
@@ -418,6 +444,7 @@
                     new Attributes.Name(FXHelper.JAVAFX_APPLICATION_MARKER))) {
                 return FXHelper.class.getName();
             }
+
             return mainValue.trim();
         } catch (IOException ioe) {
             abort(ioe, "java.launcher.jar.error1", jarname);
--- a/src/share/classes/sun/launcher/resources/launcher.properties	Thu Feb 21 17:55:33 2013 -0800
+++ b/src/share/classes/sun/launcher/resources/launcher.properties	Tue Feb 26 12:54:39 2013 +0400
@@ -139,6 +139,8 @@
     Error: An unexpected error occurred while trying to open file {0}
 java.launcher.jar.error2=manifest not found in {0}
 java.launcher.jar.error3=no main manifest attribute, in {0}
+java.launcher.jar.error4=no Profile manifest attribute in {0}
+java.launcher.jar.error5=Profile {0} required by {1} not supported by this runtime
 java.launcher.init.error=initialization error
 java.launcher.javafx.error1=\
     Error: The JavaFX launchApplication method has the wrong signature, it\n\
--- a/src/share/classes/sun/misc/URLClassPath.java	Thu Feb 21 17:55:33 2013 -0800
+++ b/src/share/classes/sun/misc/URLClassPath.java	Tue Feb 26 12:54:39 2013 +0400
@@ -35,6 +35,7 @@
 import java.util.jar.Manifest;
 import java.util.jar.Attributes;
 import java.util.jar.Attributes.Name;
+import java.util.jar.UnsupportedProfileException;
 import java.net.JarURLConnection;
 import java.net.MalformedURLException;
 import java.net.URL;
@@ -64,6 +65,12 @@
     final static String JAVA_VERSION;
     private static final boolean DEBUG;
 
+    /**
+     * Used by launcher to indicate that checking of the JAR file "Profile"
+     * attribute has been suppressed.
+     */
+    private static boolean profileCheckSuppressedByLauncher;
+
     static {
         JAVA_VERSION = java.security.AccessController.doPrivileged(
             new sun.security.action.GetPropertyAction("java.version"));
@@ -582,6 +589,15 @@
         }
     }
 
+    /**
+     * Used by the launcher to suppress further checking of the JAR file Profile
+     * attribute (necessary when the launcher is aborting as the abort involves
+     * a resource lookup that may involve opening additional JAR files)
+     */
+    public static void suppressProfileCheckForLauncher() {
+        profileCheckSuppressedByLauncher = true;
+    }
+
     /*
      * Inner class used to represent a Loader of resources from a JAR URL.
      */
@@ -789,6 +805,28 @@
             return false;
         }
 
+        /**
+         * If the Profile attribute is present then this method checks that the runtime
+         * supports that profile.
+         *
+         * ## Add a fast path like Class-Path to avoid reading the manifest when the attribute
+         *    is not present.
+         */
+        void checkProfileAttribute() throws IOException {
+            Manifest man = jar.getManifest();
+            if (man != null) {
+                Attributes attr = man.getMainAttributes();
+                if (attr != null) {
+                    String value = attr.getValue(Name.PROFILE);
+                    if (value != null && !Version.supportsProfile(value)) {
+                        String prefix = Version.profileName().length() > 0 ?
+                            "This runtime implements " + Version.profileName() + ", " : "";
+                        throw new UnsupportedProfileException(prefix + csu + " requires " + value);
+                    }
+                }
+            }
+        }
+
         /*
          * Returns the URL for a resource with the specified name
          */
@@ -958,6 +996,12 @@
 
             ensureOpen();
             parseExtensionsDependencies();
+
+            // check Profile attribute if present
+            if (!profileCheckSuppressedByLauncher) {
+                checkProfileAttribute();
+            }
+
             if (SharedSecrets.javaUtilJarAccess().jarFileHasClassPathAttribute(jar)) { // Only get manifest when necessary
                 Manifest man = jar.getManifest();
                 if (man != null) {
--- a/src/share/classes/sun/misc/Version.java.template	Thu Feb 21 17:55:33 2013 -0800
+++ b/src/share/classes/sun/misc/Version.java.template	Tue Feb 26 12:54:39 2013 +0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -36,8 +36,11 @@
         "@@java_version@@";
 
     private static final String java_runtime_name =
-	"@@java_runtime_name@@";
- 
+        "@@java_runtime_name@@";
+
+    private static final String java_profile_name =
+        "@@java_profile_name@@";
+
     private static final String java_runtime_version =
         "@@java_runtime_version@@";
 
@@ -49,6 +52,8 @@
         System.setProperty("java.version", java_version);
         System.setProperty("java.runtime.version", java_runtime_version);
         System.setProperty("java.runtime.name", java_runtime_name);
+        if (java_profile_name.length() > 0)
+            System.setProperty("java.runtime.profile", java_profile_name);
     }
 
     private static boolean versionsInitialized = false;
@@ -90,23 +95,28 @@
         boolean isHeadless = false;
 
         /* Report that we're running headless if the property is true */
-	String headless = System.getProperty("java.awt.headless");
-	if ( (headless != null) && (headless.equalsIgnoreCase("true")) ) {
+        String headless = System.getProperty("java.awt.headless");
+        if ( (headless != null) && (headless.equalsIgnoreCase("true")) ) {
             isHeadless = true;
-	} 
+        }
 
         /* First line: platform version. */
         ps.println(launcher_name + " version \"" + java_version + "\"");
 
         /* Second line: runtime version (ie, libraries). */
 
-	ps.print(java_runtime_name + " (build " + java_runtime_version);
+        ps.print(java_runtime_name + " (build " + java_runtime_version);
 
-	if (java_runtime_name.indexOf("Embedded") != -1 && isHeadless) {
-	    // embedded builds report headless state
-	    ps.print(", headless");
-	}
-	ps.println(')');
+        if (java_profile_name.length() > 0) {
+            // profile name
+            ps.print(", profile " + java_profile_name);
+        }
+
+        if (java_runtime_name.indexOf("Embedded") != -1 && isHeadless) {
+            // embedded builds report headless state
+            ps.print(", headless");
+        }
+        ps.println(')');
 
         /* Third line: JVM information. */
         String java_vm_name    = System.getProperty("java.vm.name");
@@ -332,6 +342,67 @@
     private static native boolean getJvmVersionInfo();
     private static native void getJdkVersionInfo();
 
+    // Possible runtime profiles, ordered from small to large
+    private final static String[] PROFILES = { "compact1", "compact2", "compact3" };
+
+    /**
+     * Returns the name of the profile that this runtime implements. The empty
+     * string is returned for the full Java Runtime.
+     */
+    public static String profileName() {
+        return java_profile_name;
+    }
+
+    /**
+     * Indicates if this runtime implements the full Java Runtime.
+     */
+    public static boolean isFullJre() {
+        return java_profile_name.length() == 0;
+    }
+
+    // cached index of this profile's name in PROFILES (1-based)
+    private static int thisRuntimeIndex;
+
+    /**
+     * Indicates if this runtime supports the given profile. Profile names are
+     * case sensitive. 
+     *
+     * @return {@code true} if the given profile is supported
+     */
+    public static boolean supportsProfile(String requiredProfile) {
+        int x = thisRuntimeIndex - 1;
+        if (x < 0) {
+            String profile = profileName();
+            if (profile.length() > 0) {
+                x = 0;
+                while (x < PROFILES.length) {
+                    if (PROFILES[x].equals(profile))
+                        break;
+                    x++;
+                }
+                if (x >= PROFILES.length)
+                    throw new InternalError(profile + " not known to sun.misc.Version");
+
+                // okay if another thread has already set it
+                thisRuntimeIndex = x + 1;
+            }
+            // else we are a full JRE
+        }
+
+        int y = 0;
+        while (y < PROFILES.length) {
+            if (PROFILES[y].equals(requiredProfile))
+                break;
+            y++;
+        }
+        if (y >= PROFILES.length) {
+            // profile not found so caller has requested something that is not defined
+            return false;
+        }
+
+        return x < 0 || x >= y;
+    }
+
 }
 
 // Help Emacs a little because this file doesn't end in .java.
--- a/src/share/classes/sun/tools/jar/Main.java	Thu Feb 21 17:55:33 2013 -0800
+++ b/src/share/classes/sun/tools/jar/Main.java	Tue Feb 26 12:54:39 2013 +0400
@@ -47,7 +47,7 @@
 class Main {
     String program;
     PrintStream out, err;
-    String fname, mname, ename;
+    String fname, mname, ename, pname;
     String zname = "";
     String[] files;
     String rootjar = null;
@@ -78,6 +78,9 @@
     static final String MANIFEST_DIR = "META-INF/";
     static final String VERSION = "1.0";
 
+    // valid values for Profile attribute
+    private static final String[] PROFILES = { "compact1", "compact2", "compact3" };
+
     private static ResourceBundle rsrc;
 
     /**
@@ -184,6 +187,14 @@
                     if (ename != null) {
                         addMainClass(manifest, ename);
                     }
+                    if (pname != null) {
+                        if (!addProfileName(manifest, pname)) {
+                            if (in != null) {
+                                in.close();
+                            }
+                            return false;
+                        }
+                    }
                 }
                 OutputStream out;
                 if (fname != null) {
@@ -230,7 +241,7 @@
                 if (manifest != null) {
                     manifest.close();
                 }
-                if (fname != null) {
+                if (ok && fname != null) {
                     // on Win32, we need this delete
                     inputFile.delete();
                     if (!tmpFile.renameTo(inputFile)) {
@@ -361,6 +372,9 @@
                 case 'e':
                      ename = args[count++];
                      break;
+                case 'p':
+                     pname = args[count++];
+                     break;
                 default:
                     error(formatMsg("error.illegal.option",
                                 String.valueOf(flags.charAt(i))));
@@ -410,7 +424,7 @@
             usageError();
             return false;
         } else if (uflag) {
-            if ((mname != null) || (ename != null)) {
+            if ((mname != null) || (ename != null) || (pname != null)) {
                 /* just want to update the manifest */
                 return true;
             } else {
@@ -544,7 +558,7 @@
                 || (Mflag && isManifestEntry)) {
                 continue;
             } else if (isManifestEntry && ((newManifest != null) ||
-                        (ename != null))) {
+                        (ename != null) || (pname != null))) {
                 foundManifest = true;
                 if (newManifest != null) {
                     // Don't read from the newManifest InputStream, as we
@@ -563,7 +577,9 @@
                 if (newManifest != null) {
                     old.read(newManifest);
                 }
-                updateManifest(old, zos);
+                if (!updateManifest(old, zos)) {
+                    return false;
+                }
             } else {
                 if (!entryMap.containsKey(name)) { // copy the old stuff
                     // do our own compression
@@ -596,10 +612,14 @@
                 Manifest m = new Manifest(newManifest);
                 updateOk = !isAmbiguousMainClass(m);
                 if (updateOk) {
-                    updateManifest(m, zos);
+                    if (!updateManifest(m, zos)) {
+                        updateOk = false;
+                    }
                 }
-            } else if (ename != null) {
-                updateManifest(new Manifest(), zos);
+            } else if (ename != null || pname != null) {
+                if (!updateManifest(new Manifest(), zos)) {
+                    updateOk = false;
+                }
             }
         }
         zis.close();
@@ -623,7 +643,7 @@
         zos.closeEntry();
     }
 
-    private void updateManifest(Manifest m, ZipOutputStream zos)
+    private boolean updateManifest(Manifest m, ZipOutputStream zos)
         throws IOException
     {
         addVersion(m);
@@ -631,6 +651,11 @@
         if (ename != null) {
             addMainClass(m, ename);
         }
+        if (pname != null) {
+            if (!addProfileName(m, pname)) {
+                return false;
+            }
+        }
         ZipEntry e = new ZipEntry(MANIFEST_NAME);
         e.setTime(System.currentTimeMillis());
         if (flag0) {
@@ -641,6 +666,7 @@
         if (vflag) {
             output(getMsg("out.update.manifest"));
         }
+        return true;
     }
 
 
@@ -687,6 +713,28 @@
         global.put(Attributes.Name.MAIN_CLASS, mainApp);
     }
 
+    private boolean addProfileName(Manifest m, String profile) {
+        // check profile name
+        boolean found = false;
+        int i = 0;
+        while (i < PROFILES.length) {
+            if (profile.equals(PROFILES[i])) {
+                found = true;
+                break;
+            }
+            i++;
+        }
+        if (!found) {
+            error(formatMsg("error.bad.pvalue", profile));
+            return false;
+        }
+
+        // overrides any existing Profile attribute
+        Attributes global = m.getMainAttributes();
+        global.put(Attributes.Name.PROFILE, profile);
+        return true;
+    }
+
     private boolean isAmbiguousMainClass(Manifest m) {
         if (ename != null) {
             Attributes global = m.getMainAttributes();
--- a/src/share/classes/sun/tools/jar/resources/jar.properties	Thu Feb 21 17:55:33 2013 -0800
+++ b/src/share/classes/sun/tools/jar/resources/jar.properties	Tue Feb 26 12:54:39 2013 +0400
@@ -36,6 +36,8 @@
 error.bad.eflag=\
 	'e' flag and manifest with the 'Main-Class' attribute cannot be specified \n\
 	 together!
+error.bad.pvalue=\
+        bad value for 'Profile' attribute: {0}
 error.nosuch.fileordir=\
         {0} : no such file or directory
 error.write.file=\
@@ -77,6 +79,7 @@
 \ \   -m  include manifest information from specified manifest file\n\
 \ \   -e  specify application entry point for stand-alone application \n\
 \ \       bundled into an executable jar file\n\
+\ \   -p  specify profile name\n\
 \ \   -0  store only; use no ZIP compression\n\
 \ \   -M  do not create a manifest file for the entries\n\
 \ \   -i  generate index information for the specified jar files\n\
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/lang/SecurityManager/NoAWT.java	Tue Feb 26 12:54:39 2013 +0400
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+ * @bug 8004502
+ * @summary Sanity check that SecurityManager methods that check AWTPermission
+ *   behave as expected when AWT is not present
+ */
+
+public class NoAWT {
+    public static void main(String[] args) {
+        SecurityManager sm = new SecurityManager();
+
+        try {
+            sm.checkAwtEventQueueAccess();
+            throw new RuntimeException("SecurityException expected");
+        } catch (SecurityException expected) { }
+
+        try {
+            sm.checkSystemClipboardAccess();
+            throw new RuntimeException("SecurityException expected");
+        } catch (SecurityException expected) { }
+
+        try {
+            sm.checkTopLevelWindow(null);
+            throw new RuntimeException("NullPointException expected");
+        } catch (NullPointerException expected) { }
+
+        if (sm.checkTopLevelWindow(new Object())) {
+            throw new RuntimeException("checkTopLevelWindow expected to return false");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/net/URLClassLoader/profiles/Basic.java	Tue Feb 26 12:54:39 2013 +0400
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.net.*;
+import java.io.File;
+import java.util.jar.*;
+
+/**
+ * Attempts to load classes or resources from a JAR file. The load should succeed
+ * if the runtime supports the profile indicated by the Profile attribute, fail
+ * with UnsupportedProfileException otherwise.
+ */
+
+public class Basic {
+
+    static int indexOf(String profile) {
+        if (profile == null || "compact1".equals(profile)) return 1;
+        if ("compact2".equals(profile)) return 2;
+        if ("compact3".equals(profile)) return 3;
+        if ("".equals(profile)) return 4;
+        return Integer.MAX_VALUE;  // unknown profile name
+    }
+
+    public static void main(String[] args) throws Exception {
+        if (args.length < 2)
+            throw new RuntimeException("Usage: java <jarfile> <classname>");
+        String jar = args[0];
+        String cn = args[1];
+
+        File lib = new File(jar);
+        URL url = lib.toURI().toURL();
+        URL urls[] = { url };
+
+        // ## replace this if there is a standard way to determine the profile
+        String thisProfile = sun.misc.Version.profileName();
+
+        String jarProfile = null;
+        try (JarFile jf = new JarFile(lib)) {
+            Manifest manifest = jf.getManifest();
+            if (manifest != null) {
+                Attributes mainAttrs = manifest.getMainAttributes();
+                if (mainAttrs != null) {
+                    jarProfile = mainAttrs.getValue(Attributes.Name.PROFILE);
+                }
+            }
+        }
+
+        boolean shouldFail = indexOf(thisProfile) < indexOf(jarProfile);
+
+        try (URLClassLoader cl = new URLClassLoader(urls)) {
+            System.out.format("Loading %s from %s ...%n", cn, jar);
+            Class<?> c = Class.forName(cn, true, cl);
+            System.out.println(c);
+            if (shouldFail)
+                throw new RuntimeException("UnsupportedProfileException expected");
+        } catch (UnsupportedProfileException x) {
+            if (!shouldFail)
+                throw x;
+            System.out.println("UnsupportedProfileException thrown as expected");
+        }
+
+        try (URLClassLoader cl = new URLClassLoader(urls)) {
+            System.out.format("Loading resource from %s ...%n", jar);
+            URL r = cl.findResource("META-INF/MANIFEST.MF");
+            System.out.println(r);
+            if (shouldFail)
+                throw new RuntimeException("UnsupportedProfileException expected");
+        } catch (UnsupportedProfileException x) {
+            if (!shouldFail)
+                throw x;
+            System.out.println("UnsupportedProfileException thrown as expected");
+        }
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/net/URLClassLoader/profiles/Lib.java	Tue Feb 26 12:54:39 2013 +0400
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package lib;
+
+public class Lib {
+    private Lib() { }
+
+    public static void doSomething() { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/net/URLClassLoader/profiles/basic.sh	Tue Feb 26 12:54:39 2013 +0400
@@ -0,0 +1,55 @@
+#
+# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+# @test
+# @bug 8003255
+# @compile -XDignore.symbol.file Basic.java Lib.java
+# @summary Test that UnsupportedProfileException thrown when attempting to
+#     load classes or resources from a JAR file with the Profile attribute
+# @run shell basic.sh
+
+if [ -z "$TESTJAVA" ]; then
+  if [ $# -lt 1 ]; then exit 1; fi
+  TESTJAVA=$1; shift
+  COMPILEJAVA=$TESTJAVA
+  TESTSRC=`pwd`
+  TESTCLASSES=`pwd`
+fi
+
+echo "Creating GoodLib.jar ..."
+echo "Profile: compact3" > good.mf
+$COMPILEJAVA/bin/jar cvfm GoodLib.jar good.mf -C $TESTCLASSES lib
+
+echo "Create BadLib.jar ..."
+echo "Profile: badname" > bad.mf
+$COMPILEJAVA/bin/jar cvfm BadLib.jar bad.mf -C $TESTCLASSES lib
+
+# remove classes so that they aren't on the classpath
+rm -rf $TESTCLASSES/lib
+
+echo "Test with GoodLib.jar ..."
+$TESTJAVA/bin/java -cp $TESTCLASSES Basic GoodLib.jar lib.Lib
+
+echo "Test with BadLib.jar ..."
+$TESTJAVA/bin/java -cp $TESTCLASSES Basic BadLib.jar lib.Lib
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/security/cert/CertStore/NoLDAP.java	Tue Feb 26 12:54:39 2013 +0400
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+ * @bug 8004502
+ * @summary Sanity check that NoSuchAlgorithmException is thrown when requesting
+ *   a CertStore of type "LDAP" and LDAP is not available.
+ */
+
+import java.security.NoSuchAlgorithmException;
+import java.security.cert.CertStore;
+import java.security.cert.LDAPCertStoreParameters;
+
+
+public class NoLDAP {
+    public static void main(String[] args) throws Exception {
+        try {
+            Class.forName("javax.naming.ldap.LdapName");
+            System.out.println("LDAP is present, test skipped");
+            return;
+        } catch (ClassNotFoundException ignore) { }
+
+        try {
+            CertStore.getInstance("LDAP", new LDAPCertStoreParameters());
+            throw new RuntimeException("NoSuchAlgorithmException expected");
+        } catch (NoSuchAlgorithmException x) {
+            System.out.println("NoSuchAlgorithmException thrown as expected");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/util/logging/Reflect.java	Tue Feb 26 12:54:39 2013 +0400
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+ * @bug 8004931
+ * @summary Invoke getDeclaredMethods on LogManager to ensure that
+ *    all types referenced in the method signatures is present.
+ */
+
+import java.util.logging.LogManager;
+import java.lang.reflect.Method;
+
+public class Reflect {
+    static void printMethods(Class<?> c) {
+        System.out.println(c);
+        for (Method m: c.getDeclaredMethods()) {
+            System.out.println("    " + m);
+        }
+    }
+    public static void main(String[] args) {
+        printMethods(java.util.logging.LogManager.class);
+        printMethods(java.util.logging.LogManager.getLogManager().getClass());
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/management/remote/mandatory/connection/NoIIOP.java	Tue Feb 26 12:54:39 2013 +0400
@@ -0,0 +1,141 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+ * @bug 8004502
+ * @summary Sanity check that attempts to use the IIOP transport or
+ *   RMIIIOPServerImpl when RMI/IIOP not present throws the expected exceptions
+ */
+
+import javax.management.MBeanServer;
+import javax.management.MBeanServerFactory;
+import javax.management.remote.*;
+import javax.management.remote.rmi.*;
+import java.net.MalformedURLException;
+import java.io.IOException;
+import javax.security.auth.Subject;
+import java.rmi.NoSuchObjectException;
+import javax.management.remote.JMXConnectorFactory;
+import javax.management.remote.JMXConnectorServerFactory;
+
+public class NoIIOP {
+
+    /**
+     * RMIIIOPServerImpl implementation for testing purposes (methods are
+     * overridden to be public to allow for testing)
+     */
+    static class MyRMIIIOPServerImpl extends RMIIIOPServerImpl {
+        MyRMIIIOPServerImpl() throws IOException {
+            super(null);
+        }
+        @Override
+        public void export() throws IOException {
+            super.export();
+        }
+        @Override
+        public String getProtocol() {
+            return super.getProtocol();
+        }
+        @Override
+        public RMIConnection makeClient(String connectionId, Subject subject)
+            throws IOException
+        {
+            return super.makeClient(connectionId, subject);
+        }
+        @Override
+        public void closeClient(RMIConnection client) throws IOException {
+            super.closeClient(client);
+        }
+        @Override
+        public void closeServer() throws IOException {
+            super.closeServer();
+        }
+    }
+
+
+    public static void main(String[] args) throws Exception {
+        try {
+            Class.forName("javax.management.remote.rmi._RMIConnectionImpl_Tie");
+            System.out.println("RMI/IIOP appears to be supported, test skipped");
+            return;
+        } catch (ClassNotFoundException okay) { }
+
+        JMXServiceURL url = new JMXServiceURL("service:jmx:iiop://");
+        MBeanServer mbs = MBeanServerFactory.createMBeanServer();
+
+
+        // test JMXConnectorFactory/JMXConnectorServerFactory
+
+        try {
+            JMXConnectorFactory.connect(url);
+            throw new RuntimeException("connect did not throw MalformedURLException");
+        } catch (MalformedURLException expected) { }
+
+        try {
+            JMXConnectorServerFactory.newJMXConnectorServer(url, null, null);
+            throw new RuntimeException("newJMXConnectorServer did not throw MalformedURLException");
+        } catch (MalformedURLException expected) { }
+
+
+        // test RMIConnector/RMIConnectorServer
+
+        RMIConnector connector = new RMIConnector(url, null);
+        try {
+            connector.connect();
+            throw new RuntimeException("connect did not throw IOException");
+        } catch (IOException expected) { }
+
+        RMIConnectorServer server = new RMIConnectorServer(url, null, mbs);
+        try {
+            server.start();
+            throw new RuntimeException("start did not throw IOException");
+        } catch (IOException expected) { }
+
+
+        // test RMIIIOPServerImpl
+
+        MyRMIIIOPServerImpl impl = new MyRMIIIOPServerImpl();
+        impl.setMBeanServer(mbs);
+        System.out.println(impl.getProtocol());
+
+        try {
+            impl.export();
+            throw new RuntimeException("export did not throw IOException");
+        } catch (IOException expected) { }
+
+        try {
+            impl.newClient(null);
+            throw new RuntimeException("newClient did not throw IOException");
+        } catch (IOException expected) { }
+
+        try {
+            impl.toStub();
+            throw new RuntimeException("toStub did not throw NoSuchObjectException");
+        } catch (NoSuchObjectException expected) { }
+
+        try {
+            impl.closeServer();
+            throw new RuntimeException("closeServer did not throw NoSuchObjectException");
+        } catch (NoSuchObjectException expected) { }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/naming/InitialContext/NoApplet.java	Tue Feb 26 12:54:39 2013 +0400
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+ * @bug 8004502
+ * @summary Sanity check that specifying the APPLET property when creating an
+ *   InitialContext behaves as expected when java.awt.Applet is not present
+ */
+
+import javax.naming.*;
+import java.util.Hashtable;
+
+public class NoApplet {
+    public static void main(String[] args) throws NamingException {
+         Hashtable<Object,Object> env = new Hashtable<>();
+         env.put(Context.APPLET, new Object());
+         try {
+             Context ctxt = new InitialContext(env);
+             throw new RuntimeException("ClassCastException expected");
+         } catch (ClassCastException expected) { }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/sun/net/www/protocol/http/NoNTLM.java	Tue Feb 26 12:54:39 2013 +0400
@@ -0,0 +1,240 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+ * @bug 8004502
+ * @summary Sanity check that NTLM will not be selected by the http protocol
+ *    handler when running on a profile that does not support NTLM
+ * @run main/othervm NoNTLM
+ */
+
+import java.net.*;
+import java.io.*;
+import sun.net.www.MessageHeader;
+
+public class NoNTLM {
+
+    static final String CRLF = "\r\n";
+
+    static final String OKAY =
+        "HTTP/1.1 200" + CRLF +
+        "Content-Length: 0" + CRLF +
+        "Connection: close" + CRLF +
+        CRLF;
+
+    static class Client implements Runnable {
+        private final URL url;
+        private volatile IOException ioe;
+        private volatile int respCode;
+
+        Client(int port) throws IOException {
+            this.url = new URL("http://127.0.0.1:" + port + "/foo.html");
+        }
+
+        public void run() {
+            try {
+                HttpURLConnection uc =
+                    (HttpURLConnection)url.openConnection(Proxy.NO_PROXY);
+                try {
+                    uc.getInputStream();
+                } catch (IOException x) {
+                    respCode = uc.getResponseCode();
+                    throw x;
+                }
+                uc.disconnect();
+            } catch (IOException x) {
+                if (respCode == 0)
+                    respCode = -1;
+                ioe = x;
+            }
+        }
+
+        IOException ioException() {
+            return ioe;
+        }
+
+        int respCode() {
+            return respCode;
+        }
+
+        static void start(int port) throws IOException {
+            Client client = new Client(port);
+            new Thread(client).start();
+        }
+    }
+
+    /**
+     * Return the http response with WWW-Authenticate headers for the given
+     * authentication schemes.
+     */
+    static String authReplyFor(String... schemes) {
+        // construct the server reply
+        String reply = "HTTP/1.1 401 Unauthorized" + CRLF +
+                       "Content-Length: 0"+ CRLF +
+                       "Connection: close" + CRLF;
+        for (String s: schemes) {
+            switch (s) {
+                case "Basic" :
+                    reply += "WWW-Authenticate: Basic realm=\"wallyworld\"" + CRLF;
+                    break;
+                case "Digest" :
+                    reply += "WWW-Authenticate: Digest" +
+                             " realm=\"wallyworld\"" +
+                             " domain=/" +
+                             " nonce=\"abcdefghijklmnopqrstuvwxyz\"" +
+                             " qop=\"auth\"" + CRLF;
+                    break;
+                case "NTLM" :
+                    reply += "WWW-Authenticate: NTLM" + CRLF;
+                    break;
+                default :
+                    throw new RuntimeException("Should not get here");
+            }
+        }
+        reply += CRLF;
+        return reply;
+    }
+
+    /**
+     * Test the http protocol handler with the given authentication schemes
+     * in the WWW-Authenticate header.
+     */
+    static void test(String... schemes) throws IOException {
+
+        // the authentication scheme that the client is expected to choose
+        String expected = null;
+        for (String s: schemes) {
+            if (expected == null) {
+                expected = s;
+            } else if (s.equals("Digest")) {
+                expected = s;
+            }
+        }
+
+        // server reply
+        String reply = authReplyFor(schemes);
+
+        System.out.println("====================================");
+        System.out.println("Expect client to choose: " + expected);
+        System.out.println(reply);
+
+        try (ServerSocket ss = new ServerSocket(0)) {
+            Client.start(ss.getLocalPort());
+
+            // client ---- GET ---> server
+            // client <--- 401 ---- server
+            try (Socket s = ss.accept()) {
+                new MessageHeader().parseHeader(s.getInputStream());
+                s.getOutputStream().write(reply.getBytes("US-ASCII"));
+            }
+
+            // client ---- GET ---> server
+            // client <--- 200 ---- server
+            String auth;
+            try (Socket s = ss.accept()) {
+                MessageHeader mh = new MessageHeader();
+                mh.parseHeader(s.getInputStream());
+                s.getOutputStream().write(OKAY.getBytes("US-ASCII"));
+                auth = mh.findValue("Authorization");
+            }
+
+            // check Authorization header
+            if (auth == null)
+                throw new RuntimeException("Authorization header not found");
+            System.out.println("Server received Authorization header: " + auth);
+            String[] values = auth.split(" ");
+            if (!values[0].equals(expected))
+                throw new RuntimeException("Unexpected value");
+        }
+    }
+
+    /**
+     * Test the http protocol handler with one WWW-Authenticate header with
+     * the value "NTLM".
+     */
+    static void testNTLM() throws Exception {
+        // server reply
+        String reply = authReplyFor("NTLM");
+
+        System.out.println("====================================");
+        System.out.println("Expect client to fail with 401 Unauthorized");
+        System.out.println(reply);
+
+        try (ServerSocket ss = new ServerSocket(0)) {
+            Client client = new Client(ss.getLocalPort());
+            Thread thr = new Thread(client);
+            thr.start();
+
+            // client ---- GET ---> server
+            // client <--- 401 ---- client
+            try (Socket s = ss.accept()) {
+                new MessageHeader().parseHeader(s.getInputStream());
+                s.getOutputStream().write(reply.getBytes("US-ASCII"));
+            }
+
+            // the client should fail with 401
+            System.out.println("Waiting for client to terminate");
+            thr.join();
+            IOException ioe = client.ioException();
+            if (ioe != null)
+                System.out.println("Client failed: " + ioe);
+            int respCode = client.respCode();
+            if (respCode != 0 && respCode != -1)
+                System.out.println("Client received HTTP response code: " + respCode);
+            if (respCode != HttpURLConnection.HTTP_UNAUTHORIZED)
+                throw new RuntimeException("Unexpected response code");
+        }
+    }
+
+    public static void main(String[] args) throws Exception {
+        // assume NTLM is not supported when Kerberos is not available
+        try {
+            Class.forName("javax.security.auth.kerberos.KerberosPrincipal");
+            System.out.println("Kerberos is present, assuming NTLM is supported too");
+            return;
+        } catch (ClassNotFoundException okay) { }
+
+        // setup Authenticator
+        Authenticator.setDefault(new Authenticator() {
+            @Override
+            protected PasswordAuthentication getPasswordAuthentication() {
+                return new PasswordAuthentication("user", "pass".toCharArray());
+            }
+        });
+
+        // test combinations of authentication schemes
+        test("Basic");
+        test("Digest");
+        test("Basic", "Digest");
+        test("Basic", "NTLM");
+        test("Digest", "NTLM");
+        test("Basic", "Digest", "NTLM");
+
+        // test NTLM only, this should fail with "401 Unauthorized"
+        testNTLM();
+
+        System.out.println();
+        System.out.println("TEST PASSED");
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/sun/security/ssl/sanity/ciphersuites/NoKerberos.java	Tue Feb 26 12:54:39 2013 +0400
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+ * @bug 8004502
+ * @summary Sanity check to ensure that Kerberos cipher suites cannot be
+ *   negotiated when running on a compact profile that does not include Kerberos
+ */
+
+import java.net.*;
+import java.util.*;
+import javax.net.ssl.*;
+
+public class NoKerberos {
+
+    static final List<String> KERBEROS_CIPHER_SUITES = Arrays.asList(
+        "TLS_KRB5_WITH_RC4_128_SHA",
+        "TLS_KRB5_WITH_RC4_128_MD5",
+        "TLS_KRB5_WITH_3DES_EDE_CBC_SHA",
+        "TLS_KRB5_WITH_3DES_EDE_CBC_MD5",
+        "TLS_KRB5_WITH_DES_CBC_SHA",
+        "TLS_KRB5_WITH_DES_CBC_MD5",
+        "TLS_KRB5_EXPORT_WITH_RC4_40_SHA",
+        "TLS_KRB5_EXPORT_WITH_RC4_40_MD5",
+        "TLS_KRB5_EXPORT_WITH_DES_CBC_40_SHA",
+        "TLS_KRB5_EXPORT_WITH_DES_CBC_40_MD5"
+    );
+
+    /**
+     * Checks that the given array of supported cipher suites does not include
+     * any Kerberos cipher suites.
+     */
+    static void checkNotSupported(String[] supportedSuites) {
+        for (String suites: supportedSuites) {
+            if (KERBEROS_CIPHER_SUITES.contains(suites)) {
+                throw new RuntimeException("Supported list of cipher suites " +
+                    " should not include Kerberos cipher suites");
+            }
+        }
+    }
+
+    public static void main(String[] args) throws Exception {
+        try {
+            Class.forName("javax.security.auth.kerberos.KerberosPrincipal");
+            System.out.println("Kerberos is present, nothing to test");
+            return;
+        } catch (ClassNotFoundException okay) { }
+
+        // test SSLSocket
+        try (Socket s = SSLSocketFactory.getDefault().createSocket()) {
+            SSLSocket sslSocket = (SSLSocket)s;
+
+            checkNotSupported(sslSocket.getSupportedCipherSuites());
+
+            // attempt to enable each of the Kerberos cipher suites
+            for (String kcs: KERBEROS_CIPHER_SUITES) {
+                String[] suites = { kcs };
+                try {
+                    sslSocket.setEnabledCipherSuites(suites);
+                    throw new RuntimeException("SSLSocket.setEnabledCipherSuitessuites allowed " +
+                        kcs + " but Kerberos not supported");
+                } catch (IllegalArgumentException expected) { }
+            }
+        }
+
+        // test SSLServerSocket
+        try (ServerSocket ss = SSLServerSocketFactory.getDefault().createServerSocket()) {
+            SSLServerSocket sslSocket = (SSLServerSocket)ss;
+
+            checkNotSupported(sslSocket.getSupportedCipherSuites());
+
+            // attempt to enable each of the Kerberos cipher suites
+            for (String kcs: KERBEROS_CIPHER_SUITES) {
+                String[] suites = { kcs };
+                try {
+                    sslSocket.setEnabledCipherSuites(suites);
+                    throw new RuntimeException("SSLSocket.setEnabledCipherSuitessuites allowed " +
+                        kcs + " but Kerberos not supported");
+                } catch (IllegalArgumentException expected) { }
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/jar/AddAndUpdateProfile.java	Tue Feb 26 12:54:39 2013 +0400
@@ -0,0 +1,129 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+ * @bug 8003255
+ * @compile -XDignore.symbol.file AddAndUpdateProfile.java
+ * @run main AddAndUpdateProfile
+ * @summary Basic test of jar tool "p" option to add or update the Profile
+ *    attribute in the main manifest of a JAR file
+ */
+
+import java.util.jar.*;
+import static java.util.jar.Attributes.Name.*;
+import java.nio.file.*;
+import java.io.IOException;
+
+import sun.tools.jar.Main;
+
+public class AddAndUpdateProfile {
+    static boolean doJar(String... args) {
+        System.out.print("jar");
+        for (String arg: args)
+            System.out.print(" " + arg);
+        System.out.println("");
+
+        Main jartool = new Main(System.out, System.err, "jar");
+        return jartool.run(args);
+    }
+
+    static void jar(String... args) {
+        if (!doJar(args))
+            throw new RuntimeException("jar command failed");
+    }
+
+    static void jarExpectingFail(String... args) {
+        if (doJar(args))
+            throw new RuntimeException("jar command not expected to succeed");
+    }
+
+    static void checkMainAttribute(String jarfile, Attributes.Name name,
+                                   String expectedValue)
+        throws IOException
+    {
+        try (JarFile jf = new JarFile(jarfile)) {
+            Manifest mf = jf.getManifest();
+            if (mf == null && expectedValue != null)
+                throw new RuntimeException("Manifest not found");
+            if (mf != null) {
+                String actual = mf.getMainAttributes().getValue(name);
+                if (actual != null) {
+                    if (!actual.equals(expectedValue))
+                        throw new RuntimeException("Profile attribute has unexpected value");
+                } else {
+                    if (expectedValue != null)
+                        throw new RuntimeException("Profile attribute should not be present");
+                }
+            }
+        }
+    }
+
+    public static void main(String[] args) throws Exception {
+        Path entry = Files.createFile(Paths.get("xfoo"));
+        String jarfile = "xFoo.jar";
+        try {
+
+            // create JAR file with Profile attribute
+            jar("cfp", jarfile, "compact1", entry.toString());
+            checkMainAttribute(jarfile, PROFILE, "compact1");
+
+            // attempt to create JAR file with Profile attribute and bad value
+            jarExpectingFail("cfp", jarfile, "garbage", entry.toString());
+            jarExpectingFail("cfp", jarfile, "Compact1", entry.toString());
+            jarExpectingFail("cfp", jarfile, "COMPACT1", entry.toString());
+
+            // update value of Profile attribute
+            jar("ufp", jarfile, "compact2");
+            checkMainAttribute(jarfile, PROFILE, "compact2");
+
+            // attempt to update value of Profile attribute to bad value
+            // (update should not change the JAR file)
+            jarExpectingFail("ufp", jarfile, "garbage");
+            checkMainAttribute(jarfile, PROFILE, "compact2");
+            jarExpectingFail("ufp", jarfile, "COMPACT1");
+            checkMainAttribute(jarfile, PROFILE, "compact2");
+
+            // create JAR file with both a Main-Class and Profile attribute
+            jar("cfep", jarfile, "Foo", "compact1", entry.toString());
+            checkMainAttribute(jarfile, MAIN_CLASS, "Foo");
+            checkMainAttribute(jarfile, PROFILE, "compact1");
+
+            // update value of Profile attribute
+            jar("ufp", jarfile, "compact2");
+            checkMainAttribute(jarfile, PROFILE, "compact2");
+
+            // create JAR file without Profile attribute
+            jar("cf", jarfile, entry.toString());
+            checkMainAttribute(jarfile, PROFILE, null);
+
+            // update value of Profile attribute
+            jar("ufp", jarfile, "compact3");
+            checkMainAttribute(jarfile, PROFILE, "compact3");
+
+        } finally {
+            Files.deleteIfExists(Paths.get(jarfile));
+            Files.delete(entry);
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/launcher/profiles/Basic.java	Tue Feb 26 12:54:39 2013 +0400
@@ -0,0 +1,231 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug 8003255
+ * @compile -XDignore.symbol.file Basic.java Main.java Logging.java
+ * @run main Basic
+ * @summary Test the launcher checks the Profile attribute of executable JAR
+ *     files. Also checks that libraries that specify the Profile attribute
+ *     are not loaded if the runtime does not support the required profile.
+ */
+
+import java.io.*;
+import java.util.jar.*;
+import static java.util.jar.JarFile.MANIFEST_NAME;
+import java.util.zip.*;
+import java.nio.file.*;
+import java.nio.file.attribute.BasicFileAttributes;
+
+public class Basic {
+
+    static final String MANIFEST_DIR = "META-INF/";
+
+    static final String JAVA_HOME = System.getProperty("java.home");
+    static final String OS_NAME = System.getProperty("os.name");
+    static final String OS_ARCH = System.getProperty("os.arch");
+
+    static final String JAVA_CMD =
+            OS_NAME.startsWith("Windows") ? "java.exe" : "java";
+
+    static final boolean NEED_D64 =
+            OS_NAME.equals("SunOS") &&
+            (OS_ARCH.equals("sparcv9") || OS_ARCH.equals("amd64"));
+
+    /**
+     * Creates a JAR file with the given attributes and the given entries.
+     * Class files are assumed to be in ${test.classes}. Note that this this
+     * method cannot use the "jar" tool as it may not be present in the image.
+     */
+    static void createJarFile(String jarfile,
+                              String mainAttributes,
+                              String... entries)
+        throws IOException
+    {
+        // create Manifest
+        Manifest manifest = new Manifest();
+        Attributes jarAttrs = manifest.getMainAttributes();
+        jarAttrs.put(Attributes.Name.MANIFEST_VERSION, "1.0");
+        if (mainAttributes.length() > 0) {
+            for (String attr: mainAttributes.split(",")) {
+                String[] s = attr.split("=");
+                jarAttrs.put(new Attributes.Name(s[0]), s[1]);
+            }
+        }
+
+        try (OutputStream out = Files.newOutputStream(Paths.get(jarfile));
+             ZipOutputStream zos = new JarOutputStream(out))
+        {
+            // add manifest directory and manifest file
+            ZipEntry e = new JarEntry(MANIFEST_DIR);
+            e.setTime(System.currentTimeMillis());
+            e.setSize(0);
+            e.setCrc(0);
+            zos.putNextEntry(e);
+            e = new ZipEntry(MANIFEST_NAME);
+            e.setTime(System.currentTimeMillis());
+            zos.putNextEntry(e);
+            manifest.write(zos);
+            zos.closeEntry();
+
+            // entries in JAR file
+            for (String entry: entries) {
+                e = new JarEntry(entry);
+                Path path;
+                if (entry.endsWith(".class")) {
+                    path = Paths.get(System.getProperty("test.classes"), entry);
+                } else {
+                    path = Paths.get(entry);
+                }
+                BasicFileAttributes attrs =
+                    Files.readAttributes(path, BasicFileAttributes.class);
+                e.setTime(attrs.lastModifiedTime().toMillis());
+                if (attrs.size() == 0) {
+                    e.setMethod(ZipEntry.STORED);
+                    e.setSize(0);
+                    e.setCrc(0);
+                }
+                zos.putNextEntry(e);
+                if (attrs.isRegularFile())
+                    Files.copy(path, zos);
+                zos.closeEntry();
+            }
+        }
+    }
+
+    /**
+     * Execute the given executable JAR file with the given arguments. This
+     * method blocks until the launched VM terminates. Any output or error
+     * message from the launched VM are printed to System.out. Returns the
+     * exit value.
+     */
+    static int exec(String jf, String... args) throws IOException {
+        StringBuilder sb = new StringBuilder();
+        sb.append(Paths.get(JAVA_HOME, "bin", JAVA_CMD).toString());
+        if (NEED_D64)
+            sb.append(" -d64");
+        sb.append(" -jar ");
+        sb.append(Paths.get(jf).toAbsolutePath());
+        for (String arg: args) {
+            sb.append(' ');
+            sb.append(arg);
+        }
+        String[] cmd = sb.toString().split(" ");
+        ProcessBuilder pb = new ProcessBuilder(cmd);
+        pb.redirectErrorStream(true);
+        Process p = pb.start();
+        BufferedReader reader =
+            new BufferedReader(new InputStreamReader(p.getInputStream()));
+        String line;
+        while ((line = reader.readLine()) != null) {
+            System.out.println(line);
+        }
+        try {
+            return p.waitFor();
+        } catch (InterruptedException e) {
+            throw new RuntimeException("Should not happen");
+        }
+    }
+
+    static void checkRun(String jf, String... args) throws IOException {
+        if (exec(jf) != 0)
+            throw new RuntimeException(jf + " failed!!!");
+    }
+
+    static void checkRunFail(String jf, String... args) throws IOException {
+        if (exec(jf) == 0)
+            throw new RuntimeException(jf + " did not fail!!!");
+        System.out.println("Failed as expected");
+    }
+
+    public static void main(String[] args) throws IOException {
+        // ## replace this if there is a standard way to determine the profile
+        String profile = sun.misc.Version.profileName();
+
+        int thisProfile = 4;
+        if ("compact1".equals(profile)) thisProfile = 1;
+        if ("compact2".equals(profile)) thisProfile = 2;
+        if ("compact3".equals(profile)) thisProfile = 3;
+
+        // "library" JAR file used by the test
+        createJarFile("Logging.jar", "", "Logging.class");
+
+        // Executable JAR file without the Profile attribute
+        if (thisProfile <= 3) {
+            createJarFile("Main.jar",
+                          "Main-Class=Main,Class-Path=Logging.jar",
+                          "Main.class");
+            checkRunFail("Main.jar");
+        }
+
+        // Executable JAR file with Profile attribute, Library JAR file without
+        for (int p=1; p<=3; p++) {
+            String attrs = "Main-Class=Main,Class-Path=Logging.jar" +
+                 ",Profile=compact" + p;
+            createJarFile("Main.jar", attrs,  "Main.class");
+            if (p <= thisProfile) {
+                checkRun("Main.jar");
+            } else {
+                checkRunFail("Main.jar");
+            }
+        }
+
+        // Executable JAR file with Profile attribute that has invalid profile
+        // name, including incorrect case.
+        createJarFile("Main.jar",
+                      "Main-Class=Main,Class-Path=Logging.jar,Profile=BadName",
+                      "Main.class");
+        checkRunFail("Main.jar");
+
+        createJarFile("Main.jar",
+                      "Main-Class=Main,Class-Path=Logging.jar,Profile=Compact1",
+                      "Main.class");
+        checkRunFail("Main.jar");
+
+        // Executable JAR file and Librrary JAR file with Profile attribute
+        createJarFile("Main.jar",
+                      "Main-Class=Main,Class-Path=Logging.jar,Profile=compact1",
+                      "Main.class");
+        for (int p=1; p<=3; p++) {
+            String attrs = "Profile=compact" + p;
+            createJarFile("Logging.jar", attrs, "Logging.class");
+            if (p <= thisProfile) {
+                checkRun("Main.jar");
+            } else {
+                checkRunFail("Main.jar");
+            }
+        }
+
+        // Executable JAR file and Library JAR with Profile attribute, value
+        // of Profile not recognized
+        createJarFile("Logging.jar", "Profile=BadName", "Logging.class");
+        createJarFile("Main.jar",
+                      "Main-Class=Main,Class-Path=Logging.jar,Profile=compact1",
+                      "Main.class");
+        checkRunFail("Main.jar");
+
+        System.out.println("TEST PASSED.");
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/launcher/profiles/Logging.java	Tue Feb 26 12:54:39 2013 +0400
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+public class Logging {
+    private Logging() { }
+
+    public static void log(String msg) {
+        System.out.println(msg);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/launcher/profiles/Main.java	Tue Feb 26 12:54:39 2013 +0400
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+public class Main {
+    private Main() { }
+
+    public static void main(String[] args) {
+        Logging.log("main running");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/launcher/profiles/VersionCheck.java	Tue Feb 26 12:54:39 2013 +0400
@@ -0,0 +1,169 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug 8003256
+ * @compile -XDignore.symbol.file VersionCheck.java
+ * @run main VersionCheck
+ * @summary Tests that "java -version" includes the name of the profile and that
+ *     it matches the name in the release file
+ */
+
+import java.nio.file.*;
+import java.io.*;
+import java.util.Properties;
+
+public class VersionCheck {
+
+    static final String JAVA_HOME = System.getProperty("java.home");
+    static final String OS_NAME = System.getProperty("os.name");
+    static final String OS_ARCH = System.getProperty("os.arch");
+
+    static final String JAVA_CMD =
+            OS_NAME.startsWith("Windows") ? "java.exe" : "java";
+
+    static final boolean NEED_D64 =
+            OS_NAME.equals("SunOS") &&
+            (OS_ARCH.equals("sparcv9") || OS_ARCH.equals("amd64"));
+
+    /**
+     * Returns {@code true} if the given class is present.
+     */
+    static boolean isPresent(String cn) {
+        try {
+            Class.forName(cn);
+            return true;
+        } catch (ClassNotFoundException ignore) {
+            return false;
+        }
+    }
+
+    /**
+     * Determines the profile by checking whether specific classes are present.
+     * Returns the empty string if this runtime does not appear to be a profile
+     * of Java SE.
+     */
+    static String probeProfile() {
+        if (isPresent("java.awt.Window"))
+            return "";
+        if (isPresent("java.lang.management.ManagementFactory"))
+            return "compact3";
+        if (isPresent("java.sql.DriverManager"))
+            return "compact2";
+        return "compact1";
+    }
+
+    /**
+     * Execs java with the given parameters. The method blocks until the
+     * process terminates. Returns a {@code ByteArrayOutputStream} with any
+     * stdout or stderr from the process.
+     */
+    static ByteArrayOutputStream execJava(String... args)
+        throws IOException
+    {
+        StringBuilder sb = new StringBuilder();
+        sb.append(Paths.get(JAVA_HOME, "bin", JAVA_CMD).toString());
+        if (NEED_D64)
+            sb.append(" -d64");
+        for (String arg: args) {
+            sb.append(' ');
+            sb.append(arg);
+        }
+        String[] cmd = sb.toString().split(" ");
+        ProcessBuilder pb = new ProcessBuilder(cmd);
+        pb.redirectErrorStream(true);
+        Process p = pb.start();
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        byte[] buf = new byte[1024];
+        int n;
+        do {
+            n = p.getInputStream().read(buf);
+            if (n > 0)
+               baos.write(buf, 0, n);
+        } while (n > 0);
+        try {
+            int exitCode = p.waitFor();
+            if (exitCode != 0)
+                throw new RuntimeException("Exit code: " + exitCode);
+        } catch (InterruptedException e) {
+            throw new RuntimeException("Should not happen");
+        }
+        return baos;
+    }
+
+    public static void main(String[] args) throws IOException {
+        String reported = sun.misc.Version.profileName();
+        String probed = probeProfile();
+        if (!reported.equals(probed)) {
+            throw new RuntimeException("sun.misc.Version reports: " + reported
+               + ", but probing reports: " + probed);
+        }
+
+        String profile = probed;
+        boolean isFullJre = (profile.length() == 0);
+
+        // check that java -version includes "profile compactN"
+        String expected = "profile " + profile;
+        System.out.println("Checking java -version ...");
+        ByteArrayOutputStream baos = execJava("-version");
+        ByteArrayInputStream bain = new ByteArrayInputStream(baos.toByteArray());
+        BufferedReader reader = new BufferedReader(new InputStreamReader(bain));
+        boolean found = false;
+        String line;
+        while ((line = reader.readLine()) != null) {
+            if (line.contains(expected)) {
+                found = true;
+                break;
+            }
+        }
+        if (found && isFullJre)
+           throw new RuntimeException(expected + " found in java -version output");
+        if (!found && !isFullJre)
+            throw new RuntimeException("java -version did not include " + expected);
+
+        // check that the profile name matches the release file
+        System.out.println("Checking release file ...");
+        Properties props = new Properties();
+
+        Path home = Paths.get(JAVA_HOME);
+        if (home.getFileName().toString().equals("jre"))
+            home = home.getParent();
+        Path release = home.resolve("release");
+        try (InputStream in = Files.newInputStream(release)) {
+            props.load(in);
+        }
+        String value = props.getProperty("JAVA_PROFILE");
+        if (isFullJre) {
+            if (value != null)
+                throw new RuntimeException("JAVA_PROFILE should not be present");
+        } else {
+            if (value == null)
+                throw new RuntimeException("JAVA_PROFILE not present in release file");
+            if (!value.equals("\"" + profile + "\""))
+                throw new RuntimeException("Unexpected value of JAVA_PROFILE: " + value);
+        }
+
+        System.out.println("Test passed.");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/pack200/NoBeans.java	Tue Feb 26 12:54:39 2013 +0400
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+ * @bug 8004931
+ * @compile NoBeans.java
+ * @summary A compile-only test to ensure that implementations of Packer
+ *   and Unpacker can be compiled without implementating the
+ *   addPropertyChangeListener and removePropertyChangeListener methods.
+ */
+
+import java.io.*;
+import java.util.*;
+import java.util.jar.*;
+
+public class NoBeans {
+
+    static class MyPacker implements Pack200.Packer {
+        public SortedMap<String,String> properties() { return null; }
+        public void pack(JarFile in, OutputStream out) { }
+        public void pack(JarInputStream in, OutputStream out) { }
+    }
+
+    static class MyUnpacker implements Pack200.Unpacker {
+        public SortedMap<String,String> properties() { return null; }
+        public void unpack(InputStream in, JarOutputStream out) { }
+        public void unpack(File in, JarOutputStream out) { }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/pack200/Reflect.java	Tue Feb 26 12:54:39 2013 +0400
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+ * @summary Invoke getDeclaredMethods on Packer and Unpacker to ensure
+ *    that all types referenced in the method signatures is present.
+ */
+
+import java.util.jar.Pack200;
+import java.util.jar.Pack200.Packer;
+import java.util.jar.Pack200.Unpacker;
+import java.lang.reflect.Method;
+
+public class Reflect {
+    static void printMethods(Class<?> c) {
+        System.out.println(c);
+        for (Method m: c.getDeclaredMethods()) {
+            System.out.println("    " + m);
+        }
+    }
+    public static void main(String[] args) {
+        printMethods(Pack200.Packer.class);
+        printMethods(Pack200.Unpacker.class);
+        printMethods(Pack200.newPacker().getClass());
+        printMethods(Pack200.newUnpacker().getClass());
+    }
+}