Java
Java SE
The following list contains links to the the enhancements pages in the Java SE 7 guides documentation. Choose a technology for further information.
Changes to JDK 7, Oracle's implementation of Java SE 7, are presented in the Important RFEs Addressed for JDK 7 section.
Area: HotSpot
GetLocalInstance method.Area: Security
java.security.Signature) has been updated to include the implementation requirements. Also, all of the requirements are listed in the Implementation Requirements section of the Standard Algorithms document.Area: API: JSSE
KeyManagerFactory. In the Java SE 7 release, "PKIX" is exported as the standard algorithm name for KeyManagerFactory.KeyManagerFactory algorithm is defined as:javax.net.ssl.KeyStoreBuilderParameters.Area: API: JSSE
Area: API: Language
java.lang.ClassLoader class to support parallel loading of classes and finer-grained locking mechanism for class loading operations. Custom class loaders which would like to leverage this functionality must refer to the Class Loader API Modifications for Deadlock Fix documentation for the suggested model and requirements and be implemented accordingly.Area: API: AWT
java.awt.Cursor class contained a "protected static field" called "predefined." This field has been removed.Area: API: AWT
java.awt.Color.darker() and java.awt.Color.lighter() methods.
javac, to HotSpot (and related tools), and to the implementation of the Java SE 7 API.
Changes to Java SE 7 are presented in the Important RFEs addressed for Java SE 7 section.
Area: Scripting
Area: Tools
Area: Tools
Area: Tools
jre/lib/libjvm.so->client/libjvm.so. This was provided as a transition aid from Solaris Production JRE to the Java Reference version (more precisely ExactVM to HotSpot). This symlink will cease to exist and is no longer supported.Area: Tools
Area: Tools
keytool and jarsigner utilities have been updated to be stronger. See the keytool and jarsigner tool docs for more information.Area: Tools
keytool and jarsigner tools now support the ECC algorithm in keypair generation and jar signing.Area: Tools
keytool command (-gencert) is provided to generate a non self-signed certificate. A new option (-ext) is provided to generate several X.509 v3 extensions for the -gencert, -genkeypair, and -certreq commands. There are also other new commands and options for the keytool and jarsigner tools. See the keytool and jarsigner tool docs for more information.Area: Tools
javadoc tool has been updated to use style markup classes that can control the styles of the generated pages. With the -stylesheetfile option, you can provide an alternate stylesheet file to be used. Without this option, the javadoc tool automatically creates a stylesheet file called "stylesheet.css". You can override this default with another file name, for example:
C:> javadoc -stylesheetfile C:\user\exampleStylesheet.css com.examplePackage
The generated pages have style markups for various sections. Through the stylesheet file you can define styles for these sections. The default stylesheet file is sorted according to each style in that section. You can customize the styles for:
Area: HotSpot
StackMapTable attributes when appropriate. For classfiles with version 50, the HotSpot JVM would (and continues to) failover to the type-inferencing verifier if the stackmaps in the file were missing or incorrect. This failover behavior does not occur for classfiles with version 51 (the default version for JDK7).Area: HotSpot
String.intern() method will see more significant differences.Area: HotSpot
Area: HotSpot
CMSUseOldDefaults flag was provided. This flag restored a number of settings to a default state. During the last few years, this flag has received minimal use and most customers prefer the improved CMS performance. The CMSUseOldDefaults flag is now removed.Area: HotSpot
jstack or jmap, may not work properly when using the G1 collector.Area: HotSpot
Thread.interrupt() method would interrupt some blocking I/O operations resulting in InterruptedIOException thrown by the target thread and leaving socket or file streams in an inconsistent state. This so called "legacy interruptible I/O support" has been disabled in JDK7. Applications that previously relied on this Solaris specific behavior can re-enable this support by running with the following option on the command line: -XX:+UseVMInterruptibleIO. A future release of the JDK may remove the legacy interruptible I/O support completely.Area: JSSE
Area: JSSE
Area: SASL
Area: Installer
Area: Installer
Area: Installer
Area: Installer
-F option.Area: Installer
java.exe version fails.Area: Deployment
"--segment-limit=nnnnn" or the equivalent property "SEGMENT_LIMIT".Area: Deployment
$USER\Local Settings\Application Data\Sun\Java\Deployment\cache. If needed, you may customize it to point to a network share folder for a single application cache across domain machines.Area: Deployment
jnlp_embedded, provides the option to cache JNLP content on the HTML page and shortens applet launch time by skipping network access. The jnlp_embedded parameter has as its value the base64 encoded content of the applet JNLP file. For example:
<applet width="710" height="540" >
<param name="jnlp_href" value="launch.jnlp"/>
<param name="jnlp_embedded"
value="PD94bWwgdmVyc2lvbj0iMS4wIiB . . . dC1kZXNjPg0KPC9qbmxwPg0
K"/>
<param name="draggable" value="true"/>
</applet>
When present, the jnlp_embedded parameter value replaces the content of the JNLP value pointed to by the jn.p_href parameter. The value of jnlp_ref is then optional and only used as a backup when the content of jnlp_embedded is invalid. There are a few restrictions on the embedded JNLP content:
href from element jnlp should be relative.codebase from element jnlp should be empty (which means the codebase value will be derived from the document base URL).Area: Deployment
javaws -XClearCache.javaws -uninstall.Area: JNLP Files
-XX:HeapDumpOnOutOfMemoryError flag is now supported in JNLP files for trusted applications.Area: JNLP Files
os="Windows\ XP", os="Windows\ Vista", and os="Windows\ 7", will work as expected. Values such as os-"Win", and os="Windows" will continue to match all Windows platforms. As of this release, os="Windows\ Vista Windows\ 7" will only match Vista or Windows 7 and not Windows XP.Area: Plugin
Area: Plugin
Area: Plugin
Area: Plugin
Area: Plugin
Area: Security
Area: API: JSSE
Area: API: Language
javax.lang.model.type package, MirroredTypeException and MirroredTypesException, were unrelated. In the javac implementation, MirroredTypeException was thrown where MirroredTypesException should have been thrown. In part to address this problem, MirroredTypeException was made a subclass of MirroredTypesException. This change is binary compatible and generally preserves the behavior of existing annotation processors. However, it is possible this change may cause source incompatibilities for client programs; in those cases, changing the order of catch clauses should allow the programs to compile again.Area: API: Language
javax.lang.model.* including adding a method to the javax.lang.model.type.TypeVisitor interface. Such an addition is source incompatible with libraries that have directly implemented the TypeVisitor interface. However, such additions were foreseen as part of this API's evolution and libraries were explicitly cautioned to extend one of the utility visitors instead of directly implementing such an interface.Area: API: Utilities
java.util.TreeMap, it was previously possible to insert invalid null elements and elements not implementing Comparable into empty TreeMaps and TreeSets. Only a single invalid element could be inserted into the empty TreeMaps or TreeSets; additional elements would cause the expected NullPointerException or ClassCastException. Most other operations upon the collection would also fail. As of JDK 7, inserting an invalid null element or an element not implementing Comparable into an empty TreeMap or TreeSet throws a NullPointerException.Area: API: NIO
java.nio.ByteBuffer.allocateDirect(int) were aligned on a page boundary. In JDK 7, the implementation has changed so that direct buffers are no longer page aligned. This should reduce the memory requirements of applications that create lots of small buffers. Applications that previously relied on the undocumented alignment can revert to previous behavior if they are run with the command line option: -XX:+PageAlignDirectMemory.Area: API: AWT
java.awt.Component class specification and its "See Also" link), and the Mixing Heavyweight and Lightweight Components article. If an application uses custom code to address the mixing issue and experiences problems with the built-in support for mixing, the feature can be turned off by specifying the -Dsun.awt.disableMixing=true system property.Area: API: AWT
TrayIcon API) has been changed. Instead of looking at the current window manager, the System Tray Protocol Specification is used.Area: API: AWT
WToolkit on Windows and XToolkit on Linux/Solaris. The MToolkit implementation on Linux/Solaris is no longer supported.Area: API: AWT
java.awt.Window objects (not frames or dialogs) are regular top-level windows on X11. In the JDK 6 release, they were OverrideRedirect windows.Area: API: AWT
PERPIXEL_TRANSLUCENT kind of transparency by means of setting a non-opaque background color may not display heavyweight (e.g. AWT) child components correctly. AWT supports lightweight (e.g. Swing) components in per-pixel translucent windows only. More information on the difference between the two kinds of components can be found in the Component class specification and in the Mixing Heavyweight and Lightweight Components article.Area: API: DnD
java.awt.AWTPermission.accessClipboard permission.Area: JGSS
Area: JGSS
krb5.conf settings for Windows and *nix systems. This makes deploying a JGSS/krb5 program very easy, especially for deploying Java applets.Area: JCE
Cipher.getInstance("RSA/ECB/NoPadding") calls, when the underlying PKCS11 library supports CKM_RSA_X_509 mechanism. In addition, SunPKCS11 provider recognizes "RSA" as an alias for the "RSA/ECB/PKCS1Padding" transformation when requesting a Cipher object.Area: JCE
Cipher.getInstance(...) calls when the corresponding PKCS11 mechanism is supported by the underlying PKCS11 library:
DES, DESede, AES, and Blowfish with CBC mode and PKCS5Padding DES, DESede, AES with ECB mode and PKCS5Padding DES, DESede, AES with ECB mode and NoPadding
Area: JCE
Cipher.getInstance("AES/CTR/NoPadding") calls) when the underlying PKCS11 library supports CKM_AES_CTR mechanism.Area: JCE
CKM_SSL3_KEY_AND_MAC_DERIVECKM_TLS_KEY_AND_MAC_DERIVArea: Java DB
Area: Tools
Object[] o = new ArrayList<>[42];This program is ill-formed (according to the JLS) and should therefore be rejected.
Area: Tools
LD_LIBRARY_PATH environment variable has been purged from the Java launcher. This fix is a seamless change for most Solaris and Linux users, but Java applications invoking JDK 7 from a legacy JDK must be careful to clean up the LD_LIBRARY_PATH environment variable before executing JDK 7, or simply use JDK 7 to invoke JDK 7. For more information, see the blog entry, Purging LD_LIBRARY_PATH.Area: Tools
LD_LIBRARY_PATH environment variable, the JDK 7 launcher is vulnerable to the LD_LIBRARY_PATH value that might be picked up when a JDK6 executable invokes a JDK 7 executable and the settings in the parent executable are available to the child executable. In order to mitigate this scenario, the Java launcher will protect itself by setting LD_LIBRARY_PATH and variants on Solaris, if the environment variable LD_LIBRARY_PATH contains a path to a legacy runtime.Area: Tools
javac compiler may throw an exception if a class uses an annotation that requires a value, and the value is the first seen reference to a constant value in another class, and which is itself annotated. To work around the problem, add a static import for the constant value, so that its use as an annotation value is not the first seen reference to that value.Area: Tools
import java.util.*;
interface A { List<Number> getList(); }
interface B { List getList(); }
interface AB extends A, B {}
class Test {
void test(AB ab) {
Number n = ab.getList().get(1); //error here
}
}
This is due to the fact the ab.getList() used to be resolved as A.getList(), while now is resolved as B.getList(). Meanwhile, the following workaround can be used:
Number n = ((A)ab).getList().get(1); //works
Area: HotSpot
Area: HotSpot
-XX:-UseLoopPredicate -XX:-LoopLimitCheck flag on the command line.Area: HotSpot
Area: HotSpot
jinfojmapjstack -F/proc/sys/kernel/yama/ptrace_scope , or 2) more permanently by changing the value to 0 in /etc/sysctl.d/10-ptrace.conf and rebooting. Option 1 does not require a reboot and option 2 does require a reboot.Area: HotSpot
segv while running PorterStemmer, which is part of Apache Lucerne.-XX:-UseLoopPredicate on the command line.-XX:+AggressiveOpts, but was exposed with no command line flags in JDK 7 build 134 when the code which treats the length of a constant String as constant was enabled by default as part of the fix for 6942326.Area: Installer
MSI*.log file created in the %TEMP% folder contains the following:
MSI (s) (*:*) [*:*:*:*]: Product: Java(TM) 7 -- Removal failed. MSI (s) (*:*) [*:*:*:*]: Windows Installer removed the product. Product Name: Java(TM) 7. Product Version: 7.0.0. Product Language: 1033. Removal success or error status: 1602.To work around this problem, delete the
HKEY_CURRENT_USER\Software\JavaSoft\FIUCancel registry key, if it exists, and retry the uninstallation.Area: Webstart
href tag for the main JNLP file and offline-allowed is not specified.Area: Plugin
https sessions to perform authentication. Therefore, a username and password needs to be given to the browser and then another username and password needs to be given to Java Plugin.Area: Plugin
showDocument API when the window target name does not follow naming standards, for example if it contains spaces. The HTML specification on the W3C site defines the proper format of names. Excerpted from that site: ID and NAME tokens must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods ("."). For example, the following won't work:
showDocument("http://myhost/myDoc.html", "my window"); // Incorrect
The following code snippet, which uses a window target name that complies with the naming standard, works:
showDocument("http://myhost/myDoc.html", "my_window"); // Correct
RFE: 7074254
Area: Security
Area: Security
Area: Internationalization
GregorianCalendar instance created by invoking the toGregorianCalendar() method on javax.xml.datatype.XMLGregorianCalendar may return an incorrect first day of the week when the locale format and location are set to a different language than the system locale on Windows. The following cases are examples of locale format/location being set to a different OS Locale with a different first day of the week. For example:
| OS | Format/Location |
|---|---|
| en_US | de_DE |
| en_CA | de_DE |
| de_DE | en_CA |
| iw_IL | fi_FI, etc |
Area: Internationalization
Area: JSSE
Area: API: JMX
MLet classloader is unable to load resource files that are contained in jar files. This bug is valid in the JDK 6 and JDK 7 releases. The workaround is to obtain the jar files from the classpath.Area: API: AWT
Windows.setOpacity(), Windows.setShape(), or Windows.setBackground() methods, a developer should verify whether the desired effects are supported. This is done by invoking the GraphicsDevice.isWindowTranslucencySupported() method and specifying the desired effect as an argument. If the method reports an effect as supported, enabling it won't throw an exception. However, there are several issues when using the effects on X11 systems (Linux, Solaris).
Windows.setBackground()): while the effect may be reported as supported, windows with this effect enabled may not look transparent visually because the system isn't running any compositing manager. The system should either be running a compositing window manager (such as compiz), or a separate compositing manager (such as the xcompmgr). Unfortunately, there is no way to detect whether a compositing manager is currently running, so Java is unable to report whether the transparent window will actually appear transparent. It can only check and report that enabling the effect for a window is supported by the native platform.Window.setOpacity()): the effect may be reported as unavailable in Java, while the window manager actually supports it for active applications and is able to display semi-transparent windows. This happens because a window manager (e.g. some versions of Metacity) doesn't report the effect as supported. Please note that this is not a defect in Java, but rather a bug in the window manager. More details are available in CR 6762511.Area: API: AWT
Window.toFront() and Window.toBack() behavior on X11 systems (Linux, Solaris). AWT always performs all necessary actions required to bring a window to the top or the bottom in the stacking order, according to the specifications of the windowing systems (e.g. the ICCCM and/or the EWMH for X11 systems). Whether the actions take effect or not depends on the window manager currently running in the system. Some windowing systems enforce additional constraints on when a window may be brought to the top in the window stacking order. In most cases, the purpose for such additional constraints is to enhance usability or security of these windowing environments. In other cases, these may simply be bugs in the windowing systems. This means that invoking the Window.toFront() or Window.toBack() methods may not always produce the expected results.toFront() method, we've received several user complaints on this particular behavior while developing JDK7. All of these CRs have been closed as "Not a Defect" because AWT can't short-circuit the additional constraints, or work around any bugs in third-party software. If the problem is encountered with a Java application, in most cases it makes sense to check if native applications behave the same way, and file a bug against the windowing system accordingly.Area: API: 2D
/usr/lib/libXrender.so on older Linux versions, the new Java 2D Xrender pipeline may cause the JRE to hang, or exit without warning due to the Xserver disconnecting the application. The bug is documented on freedesktop.org, and affects applications that use the GradientPaint class. There is no known workaround other than to avoid use of gradients in your application. This bug is known to affect Red Hat Enterprise Linux (RHEL) 5.6 and earlier and Oracle Enterprise Linux (OEL) 5.6 and earlier. Other versions of a similar vintage may be similarly affected. The solution is to install version 0.9.3 or later of the Xrender library, or upgrade to a later Linux distribution, such as OEL 6. The Xrender pipeline is disabled by default in JDK 7. It can be enabled by using the following syntax for the system property: "-Dsun.java2d.xrender=True". This will issue a warning about this Xrender bug if the implementation cannot verify that the bug is not present.Area: API: Text
Bidi(AttributedCharacterIterator) constructor before the iteration index is initialized. If the index isn't set to the first char, the Bidi.baseIsLeftToRight() method may return a wrong value. To work around this, invoke the AttributedCharacterIterator.first() method to reset the iteration index before calling the Bidi(AttributedCharacterIterator) constructor if the iteration index is out of the text range.