Apr 07, 2011 — 0 comments
Since Java 5 working with RMI (Remote Method Invocation) is very easy. You don’t need the rmic compiler unless you work with legacy RMI clients. Now stubs are generated automatically at runtime. Let’s see a very minimalistic example.
In Java 6 standard support for scripting engines was introduced (JSR 223: Scripting for the JavaTM Platform). This tutorial describes how to design a scriptable application and what you need to do to allow the users to write scripts for your application in various scripting languages.
Many times it is useful to be able to get programmatically information about the network interfaces present on a host. Java standard library include a number of classes designed to provide access to this information. The most important is java.net.NetworkInterface which suffered a major face lifting in Java 6. Now it is possible to get a lot more information about every network interface in the system. Of special importance is the ability to get the MAC address of an interface.
A resource is a file situated somewhere in the class path. It can be a file in a package folder, in the classes folder or in a jar file. Resources are usually needed at runtime and they can be properties files, images and so on. The ClassLoader and Class classes provide methods to find the desired resources but a little bit of attention has to be payed to the quirks of this API.
One more nice touch in the Java 6 offensive to the desktop is giving Java applications the ability to add icons to the system tray in a pretty consistent way across platforms. Of course differences exist and they will show up to some degree in the code but at least now the framework exists and the programmer’s effort is a lot smaller.
Java 6 tries hard to make Java applications easier to integrate in the desktop environment of various platforms. One of such welcome attempts is the new java.awt.Desktop class adapted from JDIC (JDesktop Integration Components).
In Java 6 a better way of interacting with the command prompt was introduced, the java.io.Console class. Together with the utility class java.util.Scanner introduced in Java 5 this new API can be used to develop more advanced Java console applications.
Introduced in Java 6 is the option of displaying a splash screen when an application starts. The splash image file can be specified on the command line with the new splash option -splash:splash.jpg or in the manifest of a jar file with the SplashScreen-Image option.
An inner class is a class declared inside another class. The enclosing class can be a top level class or another inner class. The reason for using inner classes is to properly implement composition when the life of inner class instances are controlled by the outer class instance.
Local inner classes are declared inside of a block of code. This block can be static bloc, a constructor, a method or simply a block of code surrounded with curly braces. These classes are only visible inside the enclosing block, but inside the block full hierarchies of classes can be developed.
Help us out! More and more tutorials are submitted to Good-Tutorials each day. We could use your help with finding good tutorials. Mind lending a hand?