Java really delivers “write once, run anywhere”

By Adrian Smith6 May 2009500 words3 mins to read

Java's slogan was "write once, run anywhere". They received a certain amount of criticism but I have to say that compared to other programming languages it's really true. You can use it for:

Writing the previous version of a certain application website in Perl, there was no easy way to give the customer a "tool" to test out new versions of the configuration file. These files would normally be installed on the server, were multiple megabytes in size, and the Perl would parse and use them. For testing, it was not ideal to have to upload potential new files to the test server, due to their size.

The new version is in Java and also takes a configuration file, but I have written a Swing (desktop) tool which simply allows the tester to select a new potential configuration file from their local hard disk, and the desktop tool reuses all the processing logic 1:1 that the web server in production would use.

That wouldn't have been possible with the old version of the logic written in Perl. (I know there are windowing libraries for languages like Perl but they are hardly as easy to deploy – i.e. install on a Windows workstation – as a Java application – simply double-click the .jar file once Java is installed)

I am writing the web front-end for the new version in GWT so I can reuse certain (mainly user validation) code between the web browser (giving the user instant feedback in case of errors) and the web server (necessary for security in case someone bypasses the client and sends HTTP requests directly.) And simply pass Java objects between the web server and the web client, without having to worry about how that transfer works (JSON, XML, etc.)

Other mainstream candidates for languages which run on multiple places:

This article was written by Adrian Smith on 6 May 2009

Follow me: Facebook | Twitter | LinkedIn | Email

More on: Java | Tools