Even if the StringBuilder was around for a while now, many people still use StringBuffer in single threaded applications. The main difference is stated in the StringBuffer comments: “As of release JDK 5, this class has been supplemented with an equivalent class designed for use by a single thread, {StringBuilder}. The StringBuilder class should generally [...]
Filed under: Java API, Java Tips by Daniel Pietraru
15 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. As a result, writing distributed or client-server applications becomes trivial. Let’s see a very minimalistic example. Our scenario will have a server sharing [...]
Filed under: Java API by Daniel Pietraru
5 Comments »
Let’s imagine a very simple scenario. You are writing an application which would benefit from some user specific customization after deployment. Maybe some of your customers have specific algorithms to be executed in the context of your application. Maybe your application doesn’t solve just one problem but it is designed to solve a class of [...]
Filed under: Java API, Java Tips, Scripting by Daniel Pietraru
2 Comments »
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 [...]
Filed under: Java API, Resources by Daniel Pietraru
No Comments »
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). This API allows access to this functionality:
Filed under: Java API by Daniel Pietraru
3 Comments »
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 [...]
Filed under: Java API by Daniel Pietraru
Comments Off
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.
Filed under: Java API by Daniel Pietraru
1 Comment »