jahd.gif - 8Kb

Pro+ can now accept Java applets. To use these and have the results displayed on the Pro+ document page, all you have to do is drag and drop the relevant webpage file onto the Pro+ page. Some examples for you to try are available on the ‘Java tests’ section of this website.

Java is both a programming language and an ‘environment’. Java has been created by SUN as a ‘cross platform’ programming system. It is both powerful and flexible. The idea is that Java applications and applets can be compiled on any type of computer that has a suitable compiler and will then run on any other computer that can support a ‘Java Virtual Machine’. So for the first time it becomes possible for someone to use a RISCOS machine to compile a program that will then run, unchanged, on IBM’s, Macs, and SUN’s, as well as RISCOS computers. This is, in itself, an exciting development as it ‘levels the playing field’. It does not matter any more what operating system or hardware you are using. Choose what you prefer, and then use it to compile or run software for all platforms...

Java programs come in two forms – applications and applets. An application is a fully fledged desktop program. It can pop up windows, provide dialogues, icons, etc. Applets are similar and can do most of the same things, but have to run in a ‘host’ application.

Most applets take the form of items that appear on webpages. Java has become widely used to ‘plug in’ complex programming capabilities to webpages. Although, alas, most of the Java you see on the web it little more than ‘eye candy’ that does little of any use. However despite this, Java applets have the potential to perform quite serious tasks.

The introduction of ‘Java’ capability into Pro+ is meant to serve two purposes. The first is simply to extend their usefulness as webpage authoring, editing, or viewing tools. Now you can load a webpage that has a linked Java applet and see the results in the document. If you wish you can now also use Pro+ to write webpages that include Java applets. This is very useful for webpage authors and also for anyone who wants to use Pro+ as a multimedia display application – for example in lectures, school lessons, or illustrated talks.

The second purpose is, potentially, revolutionary. It makes it possible for TW documents to contain ‘active’ items. In effect, you can now ‘plug in’ to a Pro+ document almost any process you wish. Say you are writing a report analysing the sizes, shapes, and materials of the supports of a bridge and have to calculate the amount the bridge sags under load, or its safe limits. At present you could type all the equations into TW, and then do some separate calculations for some specific examples and describe the results – perhaps by including a graph.

Now, by using a Java applet to model the situation, you can put an active area onto the TW Plus page. Anyone reading the document (either as a TW Plus document or an exported webpage) can choose values for themselves, enter them and see the results computed and displayed before their eyes on the page!

I have put some examples of Java test/demo applets on my website so you can see the kinds of things that are now possible. One example shows an electronics experiment which you can perform interactively and see the results displayed.

smjx.gif - 20Kb Another performs a least squares fit of the data in a file and displays the resulting graph. You can edit the values in the data file, and then get a replot of the new data just by clicking on a ‘replot’ button. The image to the left shows what the result looks like on a Pro+ page. If you wish to see a full size view, click on the image to the left of this paragraph.

These examples aren’t meant to cover everything that is now possible. They are just intended as simple demos. In principle, you can write (or obtain from someone else!) a Java applet to perform any mathematical analysis or modelling you wish and display the results. The sky’s the limit! In principle we can bring together a library of applets that allow Pro+ to become a sort of ‘mini mathcad’.

In fact, Java enabling is just an example of a wider ability that Pro+ have been given. This is because the enabling has been carried out by implementing the <OBJECT> system from HTML. As a result, other forms of plugin become possible. This, once again, extends the ‘multimedia’ abilities and flexibility of the TechWriter family.

A note on security.

Given the manner in which active items embedded in ‘Word’ documents have lead to a number of ‘Word viruses’, one concern people immediately have is that the Java enabling of Pro+ may lead to similar problems. In theory, this may be true. However in practice the situation when using Java with Pro+ is much more secure than is the case with ‘Word’. There are a number of reasons for this, and I’ll just summarise a few here.

The Pro+ document does not contain the Java applet ‘hidden inside it’. The document only contains a reference to an external Java ‘class’ file. This is quite different to the ‘Word’ situation where anything might be lurking inside the document!

Java applets normally run in a ‘protected’ mode. (Often called the ‘sandbox’.) This prevents them from doing various things which are potentially dangerous. If they try, !Java will normally stop them.

SUN wish Java to be used cross platform and as the natural programming language of the web and on networks. Hence they have built in a number of security measures. (The protected mode mentioned above is one.) For example, class files will only run if their internal (method) name matches the file name.

To understand how these things protect you, consider a situation where someone tries to send you a TW document which links to an malevolent Java class file. They send you an email with the document, etc, attached. When you get the email you can see that you have received a TW document and a separate Java class file (or files). If you are suspicious, all you have to do is delete, rename, or hide the class file(s) before loading the TW document. Then they won’t be run.

In theory, the TW document may link to a remote malevolent Java class file on some other machine somewhere on the web. If so, you won’t see it attached to the email as a separate file. However, in this situation you still have two lines of defence. The first, and most obvious, is to only load the document into Pro+ when off line. Then any linked class files can’t be fetched. The second is that, if such a file is fetched, !Java will automatically run it in a protected mode. This will severely limit what it can do.

For example: by default, webfetched Java applets are only permitted to read or write files on the machine from which they were fetched. Hence !Java should automatically stop them from either reading your data and sending it over the net, or writing/deleting/altering any files on your computer. Note, though, that by default, applets run from a class file stored on your own machine have less protection as it is assumed that you have chosen to place them on your machine to run.

There are a number of other security measures built into the use of Java. In general, using Java applets is probably safer than downloading conventional RISCOS applications from web or ftp sites. For example, a rogue RISCOS application could have a !Boot file that runs things as soon as it is seen by the filer. It is also probably that a malevolent (or clumsy!) programmer who attempts to break out of the sandbox will be expecting to find themselves in a ‘Windows’ environment. Hence it is less likely that their code will then work on a RISCOS machine.

All the above means that the situation with Java enabled Pro+ is rather more secure than the users of ‘Word’ encounter. However nothing is perfect, so it is still advisable to take care when running programs of any kind which you obtained over the net or on a disc. Security is something to bear in mind, but probably not something worth worrying about so much that you become too nervous to use the enormous potential that Java enabling can offer if used sensibly.

Back to the main Pro Plus page...
ppbk.gif - 2614 bytes

Pages written using TechWriter and HTMLEdit
Content and pages maintained by: Jim Lesurf (jcgl@st-and.demon.co.uk)