page 2 page 1

dukeJava and the Amiga

Karl Jeacle

Spring 1995 saw the launch of Sun Microsystems' new portable programming language, Java. It took some time before multi-platform support became available, and it established itself as a technology which could bring interactivity to the WWW. Two years later, Java is still a buzzword in the computing magazines, and people are starting to realise that it has potential to do a lot more than just run "applets" on web pages.

Java Overview

There is an incredible amount of hype surrounding Java. Once you wade through all this dross, however, you realise that while Java has great potential, it is really nothing more than a programming language.

There are a number of features which make it stand out from all the other languages out there, but probably the most important aspect of the language is Sun's push to make Java code as portable as possible. The idea is that Java code can be written and compiled on ANY machine (that has a Java compiler) and the resulting "executable" can be run on ANY machine (that has a Java runtime engine). Sun call this "write once, run anywhere".

This is achieved by not compiling Java code into a native binary executable for a particular CPU architecture e.g. Intel x86 or Motorola 680x0, but into a "bytecode" for a "virtual machine". This machine can be thought of as a machine which has a Java CPU instead of an Intel or Motorola processor.

Because the world is not full of machines with Java CPUs, we need a piece of native software on our computers to emulate this imaginary Java CPU. This piece of software is called a Java runtime engine or Java Virtual Machine (JVM). The JVM's job is to emulate a virtual machine running a Java CPU. When Java was launched, there was obviously no such thing as a Java computer, but now Sun are shipping real Java CPUs, so before long, many machines may have Java co-processors on board to handle Java code natively in addition to a conventional CPU for their existing applications.

The upshot of all of this is that, in theory at least, it shouldn't matter what kind of computer you have to run the latest greatest applications... as long as they are written in Java. Application developers should be free to develop code on any platform which can generate Java bytecodes, and this code should in turn run on any machine that has a Java runtime engine.

Compilers

At present, the only Java compiler available for the Amiga has come from Fred Fish's ADE (Amiga Development Environment) initiative. It's a port of the Unix GNU program, guavac. As with many Unix programs, there is no fancy front-end. You just run it from a CLI prompt and tell it what Java files to compile.

If you're wondering what Java is like to program, it's very similar to C++. If you have already programmed in C++ or have C experience with a knowledge of object-oriented principles, then you should be able to pick up Java quite quickly.

Runtime Engines

P'Jami was the first attempt at porting Java to the Amiga, but unfortunately this project seems to have fallen by the wayside. In recent months, however, a number of new projects have appeared that are all working independently on creating a fully functional Amiga JVM.

Kaffe is another ADE Unix port, and is already an established JVM on many other platforms. It attempts to implement the JVM by using a Just-In-Time (JIT) compiler. The idea here is to do some smart pre-compilation and convert Java bytecodes into native machine code "on the fly" so as to increase the speed of the interpretation process. A normal JVM will simply convert each bytecode instruction it receives on an individual basis, and is thus a rather slow process.

moca

Finale Development are an up and coming Amiga developer that have announced MOca, a native Amiga JVM, which also uses the JIT technique. MOca is scheduled for launch this summer, and will use ClassAct as its GUI for running Java programs.

KOFFIE is a Freeware Amiga JVM written by Jacco van Weert. Beta versions are available on Jacco's web site. KOFFIE is based on a system called BEAST which offers programmers an environment for developing object-oriented programs using any language. For the OO literate amongst you, KOFFIE implements Java classes as BEAST classes, which means that you could develop code in C or C++ with BEAST, but still make use of the functionality provided by the Java APIs.

koffie

Right now, the only full Java solution available on the Amiga is via a Macintosh emulator such as ShapeShifter. You don't have to use the Mac exclusively though, as it's possible to compile applets on the Amiga with guavac and then flick screens to the Mac where you can use either the Sun or Apple Java Development Kit (JDK) to run the applet.

Java Resources

It's no surprise to discover that the best place to look for more information on Java is on the Internet, so below are some useful URLs which should tell you more about everything discussed in this article.

Finale Development MOca
http://www.finale-dev.com/
KOFFIE
http://www.IAEhv.nl/users/weertj/KOFFIE/KOFFIE.html
Amiga Java Page (P'Jami)
http://www.sss.co.uk/~nt/hotjava.html
Fred Fish's ADE
http://www.ninemoons.com/products/ade.html
Guavac
http://http.cs.berkeley.edu/~engberg/guavac/
Kaffe
http://www.kaffe.org/

For more information on Java in general, check out Sun's own Javasoft site. It's got all the specifications and white papers and latest information on what's hot in the Java world. If you're looking for Java applications, or libraries of code to help you write Java applets, then Gamelan is for you.

Javasoft
http://www.javasoft.com/
Gamelan
http://www.gamelan.com/

There are many books on Java now available, although most are aimed at programmers. If you want more general information on Java, by all means go to your local bookstore, but you'd be far better off surfing the web for articles, press releases and product reviews. If you're thinking of buying a Java book, an invaluable guide to some of the books available is at: http://sunsite.unc.edu/javafaq/books.html

Once piece of advice: if you are buying a book, make sure it covers the recently released version 1.1 Java language specification and not the older, more common 1.0.2 release.

Web Browsers

Despite the flexibility of Java as a general purpose programming language, its Internet popularity means that web browsers are most likely to be the first Amiga applications to make use of Java.

Because of the amount of work involved in creating a JVM, Amiga web browsers will probably provide Java support by using one of the existing Amiga JVM ports. Yvon Rozijn, author of AWeb, has indicated that this will be the path he will follow, and as soon as a suitable JVM is available, he will incorporate it into AWeb. No doubt other browsers such as IBrowse and Voyager will follow suit.

Finale Development's Web Cruiser (which should be available by the time you read this) is the latest web browser on the block. In addition to the usual array of features, such as HTML 3.2 and Frames, Finale claim that Web Cruiser will support inline Java applets as soon as their MOca JVM is available (2nd quarter 1997).

The Future

It looks as though Java is here to stay for the foreseeable future. Sun want the language to be ubiquitous. Their range of Java chips allow everything from toasters to workstations to support or make use of Java in one form or another.

If Java continues the way it's going right now, the advent of native Amiga Java support could breath new life into the machine. The number of applications available to Amiga users could literally double overnight.

Leading software companies such as Corel are releasing Java based versions of their their top applications. Java's portability means reduced development costs for them in maintaining separate PC and Macintosh ports. The advantage to Amiga owners is that this increased ease of portability could lead to many big name applications suddenly running on the Amiga.

Conclusion

Java is still a buzzword in the computing industry. All the major platforms now have Java ports. Given the recent state of affairs in the Amiga world, it's no surprise that an Amiga port isn't quite there yet, but at least a number of initiatives are underway.

If nothing else, the Amiga is a survivor. I'm optimistic that in the not-too-distant future Amiga users will be actively developing and running Java applets and applications natively, no matter what kind of Amiga they own.