Journal Articles
Browse in : |
All
> Journals
> CVu
> 136
(8)
All > Topics > Programming (877) Any of these categories - All of these categories |
Note: when you create a new publication type, the articles module will automatically use the templates user-display-[publicationtype].xt and user-summary-[publicationtype].xt. If those templates do not exist when you try to preview or display a new article, you'll get this warning :-) Please place your own templates in themes/yourtheme/modules/articles . The templates will get the extension .xt there.
Title: An Introduction to Personal Java
Author: Administrator
Date: 03 December 2001 13:15:48 +00:00 or Mon, 03 December 2001 13:15:48 +00:00
Summary:
Body:
PersonalJava is a Java Application Environment intended for use in "network connectable devices" [JavaSoft] , in other words Personal Digital Assistants (PDA's), and Set Top Boxes (STB). As such it's finding interest from the likes of mobile phone manufacturers, PDA manufactures, programmers with PDA's, and in consumer electronics where it has been adopted for the likes of digital TV (The Multimedia Home Platform (MHP) is based on PersonalJava). PersonalJava is a joint development between Sun and many device developers in the industry. As the PersonalJava API continues to be enhanced, this open collaborative process is supposed to continue.
Now this is what Java is supposed to be about! As PersonalJava takes off, we will see Java really delivering on its long promised Write Once Run Anywhere. This is a technology designed to provide a common platform, across not just chipset, or operating system but entire families of devices. As software authors we can now write our business application, personal organiser, multimedia or game and have a huge audience, not just the few users that have installed a Java Virtual Machine. Instead a far larger market exists and will grow over the coming years as these devices come to markets, where they will far outnumber the installed personal computer market.
Imagine a world where your personal organiser is synched with not just your PC, but also your television, and on each platform you can run your favourite software, be that your diary, the e-book you're reading, or the game of space invaders your kids are playing!
The PersonalJava application programming interface (API) is a collection of packages, classes and methods defined by a The PersonalJava specification. It includes the following Java API's:
-
java.applet
-
java.awt - in modified form
-
java.beans
-
java.io - in modified form, and some classes are optional
-
java.lang
-
java.math - is optional
-
java.net
-
java.rmi - is optional
-
java.security - is optional
-
java.sql - is optional
-
java.text
-
java.util
All of these are currently based on the JDK 1.1.6 API specification.
The PersonalJava application environment consists of an implementation of the PersonalJava API with the PersonalJava virtual machine. This is actually what gets shipped on a device, e.g. PersonalJava applications can run on any device that has the PersonalJava application environment resident on it.
For commercial reasons every effort has been made to reduce the memory requirements of PersonalJava, either by making non-essential bits optional, or rewriting core features to be as efficient as possible.
Where necessary, features have been added or modified in the PersonalJava from the original Java to make it more appropriate for the target devices. For example, the PersonalJava pays special attention to the needs of portable devices by providing an optimized version of the Abstract Window Toolkit (AWT) targeted to small, and perhaps "odd" shaped displays. Additionally, the PersonalJava is designed to enable application support for touch screen, joystick, remote control or pen control rather than a full keyboard.
Sun provide several development tools for the PersonalJava developer:
-
JavaCheck - a utility that confirms that your application is a conforming PersonalJava application.
-
PersonalJava Emulation - An emulation environment, test your apps on the desktop before deploying them.
-
JDK - The Java Development Kit, the tools any Java developer has grown used to, and there is no special compiler for PersonalJava, it's the same one you've always used.
It's almost obligatory now to begin any tutorial relating to software with some form of Hello, World program. Well it makes me feel at home anyway, and gives one confidence that the environment and development tools are installed and configured correctly. For this article I'm going to look at PersonalJava deployed using the Sun VM on a Compaq iPaq H3630. (If anyone feels like donating another suitable platform I'll write an article based on that platform).
It's the simplest program we can start with, the console based Hello World program:
import java.io.*; public class HelloWorld { public static void main(String[] args) { System.out.println("Hello World"); } }
Moving into more complex territory, and as my PDA doesn't really support console based applications lets have a look at an AWT based Hello World:
import java.awt.*; import java.awt.event.*; public class Hello extends Frame { static Frame window = new Frame("Hello"); public static void main(String[] args) { // Create the Hello World label Label hello_label = new Label("Hello World"); Panel hello_panel = new Panel(); hello_panel.add(hello_label); window.add(BorderLayout.CENTER, hello_panel); // Create an exit button, and associate the click event Button exitButton = new Button("Exit"); exitButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { System.exit(0); } }); window.add(BorderLayout.SOUTH, exitButton); // prepare to open fullscreen Dimension screen_dimension = Toolkit.getDefaultToolkit().getScreenSize(); window.setSize(screen_dimension.width, screen_dimension.height); // show the window window.show(); } }
Which gives us the following:
What is really great about this is that unlike the development I've been looking at using Microsoft Embedded Visual C++, where I have to recompile for each chipset, let alone operating system, this is truly portable code, and the same programs will run on my desktop!
The PersonalJava homepage , includes links to download the Personal Java specification, Windows CE runtime, and the Personal Java emulation environment. There are several other 3rd party VM's and a number of other companies are developing PersonalJava systems for their market places.
[JavaSoft] http://www.javasoft.com
[MHP] http://www.mhp.org
[homepage] PersonalJava homepage - http://java.sun.com/products/personaljava/
Notes:
More fields may be available via dynamicdata ..