sanos home

Running java applications on sanos



You can run the Windows version of Sun HotSpot JVM under sanos. This is possible because sanos supports the standard PE executable format (.EXE and .DLL files). Wrappers are provided for the Win32 DLLs like kernel32.dll, user32.dll, wsock32.dll, etc., as well as the C runtime library msvcrt.dll. I have tested sanos with the following JVMs:

As a demonstration of running a java server application under sanos I have made an installation image with sanos, HotSpot JVM and Tomcat web server.


Sanos-Java-Tomcat Live CD


The easiest way to try it is to download and unzip the live CD ISO image. You can burn this image to a CD-ROM using your favorite CD-burner program and then boot the computer from the CD-ROM. You can also try it out using VMware by setting the sjt-livecd.iso as the ISO image for the CD-ROM device.

When you boot from the CD-ROM sanos will startup and run Tomcat in the JVM. Please ignore the exceptions during startup. Tomcat wants to write to the conf directory, but this is a no-go on a CD-ROM. Type more /proc/netif in the shell to find the IP assigned to sanos. The live CD uses DHCP to get an IP address (in this example

You are now ready to try the tomcat server. Point you browser to and the standard Tomcat homepage should be shown. You can browse the sanos file system by navigating to Please notice that the Live CD configuration is not a "secure" configuration and should only be used for demo purposes. The file system is exposed in the browser. Also, the shell is listening on the telnet port and it does not require any password to login.


Sanos-Java-Tomcat Install CD


You can also install the sanos-java-tomcat example on your hard disk. If you want to try it on VMware:

NB: There is an error in the setup script. You have to copy the shell (sh.exe) manually to the hard disk. You can boot on the CD-ROM image and copy the shell manually:

mount hd0a /mnt
cp /usr/bin/sh.exe /mnt/bin/sh.exe
umount /mnt

You can test the installation by pointing your browser at http://<ipaddr>. This should show you the default tomcat start page. If you want to browse the files on the sanos machine point your browser at http://<ipaddr>/files.


Configuring sanos for java applications


Let's look at how you configure sanos for running java applications. In the /usr/java directory a standard Sun HotSpot Java VM for Windows is installed. These files are the same files as you use on you windows box for running java programs. The tomcat web server is located in /usr/tomcat. The web applications are installed under /usr/tomcat/webapps. Package your web application as a .war file and place it in this directory.

How does sanos know which java application to run? This is configured in /etc/os.ini:

# os.ini







In the [os] section you can see that initpgm is set to the jinit.exe program. This makes sanos run the jinit program when sanos has booted.  The jinit program is similar to java.exe under Windows except jinit uses the configuration in /etc/os.ini where java.exe uses a combination of the registry, the command line, the current directory and environment variables to obtain startup and configuration parameters for the java vm.

The jinit program looks in the [java] section for the location of the jvm and the main class for the java application. If you want to pass command line arguments to the main class add a mainargs parameter to the [java] section. The [java.options] section contains the parameters for the java vm. In the [] section you can specify system properties for the application. These are the properties you normally specify with the -D option to java.exe. The [java.classpath] section contains the jar files and directories for your application.