Category Archives: Java

Apple’s assault on Java is an Assault Java Developers

Yesterday, Apple announced that its next version of OS X, called “Lion”, will include an App store to simplify the process of downloading, purchasing, and updating applications on the Mac.

This is great news!

Apple will take a 30% cut of all transactions performed through the app store.

I’m mixed about this. If the App store is able to increase the sales of my apps by more than 30%, then it might be worth it. Otherwise, this is just a 30% tax off the top of all of my app income.

In a much less hyped announcement, Apple has deprecated Java as of version 1.6 update 3, and may not continue to bundle Java with future releases of OS X.

This is bad news… and it could be terrible news if Oracle or someone else doesn’t pick up the slack and provide a Mac deployment for the Java VM. Although, this could be somewhat good news if the “new” steward takes better care, as Java on the Mac does lag behind other platforms in both performance and stability. Oracle taking over Java could be a good thing if it results in a better product.

One final non-announcement came in the form of a guideline for admission to the Mac App store: Applications that use deprecated API’s (e.g. Java) will be rejected from the App store.

This is terrible news! A betrayal of the first order. It appears that Apple now feels confident enough with its market position to close the doors on all but their faithful Objective-C developers.

I currently have 3 desktop Mac applications on the market, and 2 of them are written almost entirely in Java. I chose, and still prefer, Java as a language because it provides a fast, robust, multi-threaded environment that is easy to scale, and even easier to port over to different platforms. It took me about 4 hours to port PDF OCR X over to Windows, and most of that time was spent on the non-java portions.

I was actually intending to blog about my experience with Java and multi-platform application development and was going to advocate Java as a good platform for development on the Desktop.

In light of yesterday’s announcements, I must take a pause to consider my future. Since Apple seems to be dictating its terms in a heavy-handed way, my instinct is to stick it to “the man” (Apple) and boycott its App store and its products altogether.

But then I lean back and glance around the room at my iPad, iPhone, Apple TV, Mac Mini, and 2 Mac books…. and I question my resolve as they do indeed make nice products.

I watched from afar when Apple shut out Flash from its iPhone. But this didn’t affect me as I didn’t develop for the iPhone. And, after all, Flash runs down the battery life too fast so there was a logical technical reason for its omission. When they brazenly placed a prohibition on all advertisements served by competitors to their iAd service, I shook my head – but it didn’t really affect me. And since the iPhone was a new device, the fact that it was closed wasn’t too much of a concern, because we only had non-existence to compare to its “closed existence”, and a closed existence surely is better than non-existence

But with the Mac we are moving from an era of openness, and stepping into one that would appear to be much more closed, so I get the distinct and unpleasant feeling of having my virtual civil rights stripped away. For now, we will probably be able to download and install applications the conventional way, but such applications will likely be treated as 2nd class citizens, branded with a star, and forced to live in some hard-to-find ghetto folder. Once Apple has achieved wide-spread acceptance amongst users that the App store is the only acceptable way to obtain software, perhaps they’ll close the technical loop hole that allows those second class apps from even breathing the same air as Apple’s preferred class of fully-taxed App store apps, and we’ll be left with a completely closed, yet beautiful utopia of an operating system housing only the master race of applications that descend from Apple’s own genetic components (i.e. Objective-C) and bear the 30%-tax stamp of Approval.

Mister Jobs, you have stepped too far. I was a true believer. I am now agnostic.

Mac, you’ve got a friend in Java. Now be nice.

I have recently rediscovered the joy of programming in Java for desktop Applications. Mac OS X provides a perfect deployment system for Java applications since Java 1.6 comes standard, so you don’t have to worry about directing your users to download Java for your applications to work. What’s more, since your application is written in Java it can easily be adapted (and perhaps unchanged) to run on Windows and Linux. So what is so great about Java:

  1. It is multi-threaded from the ground up.

Although threads can be used in many other programming languages, Java presents by far the cleanest and complete implementation I have ever come across. The language is built for threads at its very core with locking and monitor capability on any object.

  1. Namespaces and packaging

Between Java’s rich namespace support and it’s native packaging JAR format Java allows you to build applications component by component with minimal hassle when it comes to putting the components together. Unlike interpreted languages like Ruby, Python, and PHP, you are able to build your sky-scraper of an application without worrying about the size of it affective the speed of it. When you’ve completed a library, you can package it up an wrap it in a bow and feel confident that this component will serve you well for many projects to come.

  1. Garbage Collection

Most of the time, honestly, I don’t want to have to worry about mundane details like deleting objects that are no longer being used. Garbage collection does add a bit of overhead to an application, but it is well worth it 99% of the time.

  1. Swing

Say what you will about Swing, but it still stands up as one of the most powerful and portable GUI toolkits available on any platform. With only a few lines of code you can have yourself a full-fledged application with the look and feel of the native operating system, and have it run on Mac, Windows, and Linux without the need for any form of recompiling. It gives you the building blocks that you need to have a rich application, and allows you to extend quite far also.

There have been some troubling trends over the past few years as they pertain to Java. New dynamic languages like Python and Ruby have gained a lot of attention at the expense of Java. Windows has stopped shipping with Java and the IPhone and IPad don’t support Java and likely never will. My website stats indicate that only about 85% of Windows user have Java installed – this is definitely less than 10 years ago when virtually all Windows machines were equipped with Java. If you do a Google search for “Java OS X” or “Java for Mac Desktop Apps” you’ll find a plethora of articles circa 2002. There is scarcely anyone talking about using Java on the Desktop in the past 3 years. Has everything worth writing been written, or is this just the writing on the wall.

I hope this does not foreshadow and end to the glory days of Java as a development platform on OS X. It would be tragic if, one day, Apple decided to leave Java out of the default install. That would force users to install Java before running any software dependent upon Java – which would make Java a much less attractive platform to develop on.

IFTPd

Ran across IFTPd (http://iftpd.sourceforge.net/)today and installed it on my westhost server.  This is great because I can run it on my virtual private server and create accounts for multiple users giving them access to exactly what they need access to.  It has a simple mechanism for defining groups and users, allowing you to create virtual file systems for the users and groups to work on. 

The default FTP daemon on my server was a little more difficult to work with, confining users to only their home ftp directory.  This is insufficient when there are multiple group projects under way.

IFTPd is also written entirely in Java and is distributed with all dependencies, so getting it running was a snap.

Still looking for a similar product for SSH, but for now, this works GREAT! 

 

Jakarta Commons FTP Client Deadlock problems

I have been experimenting with Java FTP components in my effort to create a JFileChooser component that will work over FTP. Common concensus seems to be that the best FTP component is the Jakarta Commons FTPClient class. It seems to have all of the necessary functionality, however seems to have multithreading issues. The component continually deadlocks, and I have narrowed it down to the FTPClient class. I found a post at http://www.kaffe.org/pipermail/kaffe/2005-August/103033.html that also talks about deadlocking in the FTPClient. One suggested solution is to disable the separate reader thread by calling setReaderThread(false). This helps me get a little further to the point where it usually works, but nonetheless deadlocking still occurs.

I will keep on searching for another FTP component but in the mean time I have successfully adapted JFileChooser to use SFTP (Secure FTP) using the SSH Tools libraries.

References

Hessian Web Services

I just ran across a great little library for web services, called Hessian. It is a binary web service (ie not xml) so its messages are much more compact and easier to transfer. In addition, the client and server libraries don’t require nearly as large a framework. It looks really easy and there are libraries to support Java, Python, and PHP — and maybe a few others that slipped my mind.

http://hessianphp.sourceforge.net/quickstart.html