Java 6 New Features
- Scripting Language Support
- JDBC 4.0 API
- Java Compiler API
- Pluggable Annotations
- Native PKI, Java GSS, Kerberos and LDAP support.
- Integrated Web Services.
- Lot more enhancements.
Changes in I/O
This is a new feature added in Java SE 6, which has the ability to read text from a terminal without having it echo on the screen through java.io.Console.
This is a new feature added in Java SE 6, which has the ability to read text from a terminal without having it echo on the screen through java.io.Console.
import java.io.Console;
Console console =
System.console();
System.out.println("Please key in text and press enter:");
String readLine = console.readLine();
System.out.println("Please key in text and press enter:");
String readLine = console.readLine();
char[] charArray = console.readPassword();
Networking features and enhancements in Java SE version 6.0
This feature include enhancement in networkInterface, support for Internationalized Domain Names, HTTP Negotiate Authentication and much more.
This feature include enhancement in networkInterface, support for Internationalized Domain Names, HTTP Negotiate Authentication and much more.
Enhancements in java.lang.Class and java.lang.reflect
Some new Methods are included in java.lang.Class like : getInterfaces(), getClasses(), getConsturctors(), getMethod(String, Class?) and much more.
Some new Methods are included in java.lang.Class like : getInterfaces(), getClasses(), getConsturctors(), getMethod(String, Class?) and much more.
Enhancement in RMI for JDKTM 6
java.rmi.MarshalledObject now support generics.
java.rmi.MarshalledObject now support generics.
JAVA SE 6 Security Enhancements
JAVA SE 6 has added support for some security functionality: the XML Digital signature API and implementation, Smart Card I/O API. And much more.
JAVA SE 6 has added support for some security functionality: the XML Digital signature API and implementation, Smart Card I/O API. And much more.
Serialization Changes and Enhancements in JAVA SE Development Kit 6
The new method ObjectStreamClass.lookupAny now used to obtain an ObjectStreamClass instance for a non-serializable Class.
The new method ObjectStreamClass.lookupAny now used to obtain an ObjectStreamClass instance for a non-serializable Class.
Scripting for the Java Platform
By using this Features developers integrate Java technology and scripting languages by defining a standard framework and application programming interface (API).
By using this Features developers integrate Java technology and scripting languages by defining a standard framework and application programming interface (API).
Rhino
(the Mozilla 100% Java Javascript implementation) ships with Sun's Java
6, and is about as full-featured as a Java 6 scripting engine can get.
ScriptEngineManager manager =
new ScriptEngineManager();
ScriptEngine engine = manager.getEngineByName("js");
Bindings bindings = engine.createBindings();
bindings.put("num",
"20");
Object result = engine.eval(
"fib(num);" +
"function fib(n) {" +
" if(n <= 1) return n; " +
" return fib(n-1) + fib(n-2); " +
"};",
bindings);
System.out.println(result);
Example 2:
The
eval()
method also accepts a
Reader
object, which makes it easy to store scripts in files or other external sources, as in the following example:
ScriptEngineManager manager
= new ScriptEngineManager();
ScriptEngine engine
= manager.getEngineByName("js");
engine.put("age", 21);
engine.eval(new FileReader("c:/voting.js"));
Usage:
Using
scripting languages from Java can be useful in many situations, such as
providing extensions to your Java application so that users can write
their own scripts to extend or customize
the core functionalities.
Scripting
languages are both simpler to understand and easier to write, so they
can be ideal to give (technical) end users the possibility to tailor
your product to their needs.
Most exciting new features of the JAVA SE 6 is support for the Java API for XML Web Services (JAX-WS), version 2.0.
No comments:
Post a Comment