Bootable Java CD

Installing Java on a bootable CD

Bart's PE Builder is a tool that lets you build a bootable Windows CD ROM or DVD using Windows XP or Windows Server 2003. This is a quick guide to setting up a plugin for Bart's PE Builder v3 that will allow you to install a Java Runtime and run Java programs directly from CD, without requiring any hard disk.

Installing the Java Runtime

The first step to creating the plugin is to install the Java Runtime on a Windows machine. You can download the Java Runtime for free from http://www.java.com/. These instructions are based on version 1.4.2 of the Java Runtime for Windows. If you attempt to use a different version, you may need to change some of the config files which we will describe later.

Files required for the Java Runtime plugin

If you have not already installed Bart's PE Builder, you should do so now. Create a new directory called j2re in the PE Builder plugins directory. Now go to C:\Program Files\Java\j2re1.4.2\ (or wherever you installed the Java Runtime to) and copy bin and lib into the j2re plugin directory.

Plugin configuration files

There are two configuration files that you must create in the j2re directory. j2re.inf tells PE Builder which files it needs to to include from this plugin on the bootable CD (so you may need to change this slightly if you are using a different version of Java). j2re_nu2menu.xml is used to add items to the NU2 menu system. Note that we do not need to add any menu items for the Java Runtime to work.

Running PE Builder

When you run PE Builder, this plugin will be listed as "Java 2 Runtime Environment". Make sure you tick the box if you want the Java Runtime to be installed on your bootable Windows CD. Follow the instructions and you will end up with an ISO image of the CD, which you can burn using your favourite CD burning software.

Running Java programs from the bootable CD

When you boot from the CD you have created, it will start to load the operating system from the CD. No hard disk is required. The java.exe executable can be found in D:\J2RE\BIN, where D: is your CD drive (it may be different depending on your hardware configuration). You can run Java programs as you would do normally, however, you may find it convenient to add D:\J2RE\BIN to your PATH variable. (This has to be done manually at the moment, but I will get round to changing the plugin to set this automatically soon.)

Installing Java programs on the CD

Having successfully installed the Java Runtime on a bootable Windows CD, you may now want to include some useful Java programs on the CD as well. It may seem obvious, but remember that the CD is read-only, so any programs you do run will not be able to save any information to the directory they run from. You may find it convenient to create your own plugin for each Java application you include on the CD.

Installing Java applications

This example will show you how to create a new plugin for JLogTailer, a log tailing utility written in Java. You will need to have completed all previous steps for the Java Runtime plugin before this will work.

Files required for the JLogTailer plugin

Create a new plugin directory called JLogTailer. Download the JLogTailer-2.0.0.jar file from the JLogTailer page and place it in the plugin directory. You will also need to put the two config files in the plugin directory:

Now you must build a new ISO image with both the Java Runtime and JLogTailer plugins selected.

Running JLogTailer from the bootable CD

When the CD has booted into Windows, you can open a new command window (CMD). Adding the Java executables to the PATH would be useful at this stage, as you will then not need to type the full path every time you run java.exe. If your CD is not mounted as drive D: make sure you use the correct drive letter when modifying the PATH. So here's how to run the LogTailer from the command window:

Microsoft Windows XP [Version 5.1.2600]
{C} Copyright 1985-2001 Microsoft Corp.

D:\i386\system32>set PATH=%PATH%;d:\j2re\bin

D:\i386\system32>cd ../../JLogTailer

D:\JLOGTAILER>java -jar JLogTailer-2.0.0.jar

JLogTailer will now run and you can use the menu bar to open up a new file for log tailing.

Troubleshooting

This guide has been successfully tested with PE Builder 3.0.9-BETA and 3.0.10-BETA. Let me know if I need to update the plugin to work with later versions.

Some broken graphics cards may cause the Java Virtual Machine to crash when it runs a graphical Java application within Windows PE. There is no known fix for this as yet.

There are several different revisions of the Java Runtime 1.4.2. If you receive any "file not found" errors when PE Builder is preparing the ISO image, it may be caused by slightly different filenames being used by the particular revision you are using. For example, the file bin\NPJPI142.dll may be called bin\NPJPI142_01.dll instead. For the plugin to work properly, you will need to change the names of these files in the j2re.inf file yourself.

If any of these instructions are unclear or incorrect, please let me know.

 

Search this site

 

Copyright Paul Mutton 2001-2013
http://www.jibble.org/
Feedback welcomed
email

~
Dreamhost
Web Hosting

~
Dreamhost
Web Hosting