1) JavaDB- Java DB is based on the open-source Apache Derby.This DB system has a footprint of only 2.5MB
For a great out-of-the-box development experience with database applications, the Java SE 6 development kit – though not the Java Runtime Environment (JRE) – co-bundles the all-Java JDBC database, Java DB based on Apache Derby. No more need to find and configure your own JDBC database when developing a database application! Developers will also get the updated JDBC 4.0, a well-used API with many important improvements, such as special support for XML as an SQL datatype and better integration of Binary Large OBjects (BLOBs) and Character Large OBjects (CLOBs) into the APIs.
For a great out-of-the-box development experience with database applications, the Java SE 6 development kit – though not the Java Runtime Environment (JRE) – co-bundles the all-Java JDBC database, Java DB based on Apache Derby. No more need to find and configure your own JDBC database when developing a database application! Developers will also get the updated JDBC 4.0, a well-used API with many important improvements, such as special support for XML as an SQL datatype and better integration of Binary Large OBjects (BLOBs) and Character Large OBjects (CLOBs) into the APIs.
2) Scripting
You can now mix in JavaScript technology source code, useful for prototyping. Also useful when you have teams with a variety of skill sets. More advanced developers can plug in their own scripting engines and mix their favorite scripting language in with Java code as they see fit.
Perhaps You ThougHt yOu couldN't program with a scripting language and Java togetheR. Which will yoU Be trYing ?
3)
The Java SE 6 Deque
he class java.util.ArrayDeque implements the Deque interface and it can be used as a stack with much better performance than the old java.util.Stack (since as with all of the new collections the ArrayDeque methods aren't synchronized).
4)
Console and Password
A new class java.io.Console gives access to character-based console device. To obtain the console associated with the current JVM we should use System.console() - which might return null, in the case of no character based console devices is associated to the JVM. The console (if exists) is a singleton – calling to System.console() returns the same instance – but all of write and read method are synchronized and guaranteed to be atomic (so we don't have to protect the instance for multi threading access).
Here is the nice one: a new method readPassword() - the readPassword method (there are two of them – one without a prompt and an overloading method which also gets a prompt to the user) reads a password from the user with console echo disabled (it means that the password is not printed on the console while the user enters it). Here is a sample usage
Console console = System.console();
String username = console.readLine("Username: ");
char[] c = console.readPassword("%s's password:", username);
String passString = String.copyValueOf(c);
console.printf("%s's password is: %s%n", username, passString);
And the output on my console:
Username: eyal.lupu
eyal.lupu's password:
eyal.lupu's password is: this is my password
5)
Permissions
Another addition to java.io.File is the support to query and set the writable, readable, and executable permissions on a java.io.File instance. The operations return true on success, false otherwise. For example:
File f = new File("c:/tmp/file.txt");
boolean b = f.setWritable(true, //Enable writing
true); //For everyone (false - for the owner only)
System.console().printf("Success? %s%n", b);
6) java.io.File
Size
Here is one API that some of my customers waited for – find out the number of unallocated bytes in a partition. The method getFreeSpace() finds out how many unallocated bytes a partition (disk on Windows) has. This can be used, for example, by programs which want to extract data to files and want to give the user some information about the available disk space. The documentation says that it returns the number of unallocated byte on a partition or 0 if the File object's pathname doesn't name a partition. It means that C:\ and C:\valid-directory-or-filename will return a value (since a valid pathname resides in a partition), but C:\invalid-directory-or-filename will return 0 (since we can't find out the partition). There is more: getUsableSpace() tries to find out how many available space the current JVM can use, the method tries to find out the information using file system permissions and other restrictions (like quota) – if the information is not available the same value of getFreeSpace() is returned. The last one in this group getTotalSpace() returns the total size of a partition. So using the above three methods we can print to the user the following information
| Disk | Total size | Free | Available |
| /usr/local | 10G | 2.5G | 2G |
Comments