1 Java(tm) Binary Kernel Support for Linux v1.02
2 ----------------------------------------------
4 Linux beats them ALL! While all other OS's are TALKING about direct
5 support of Java Binaries in the OS, Linux is doing it!
7 You can execute Java applications and Java Applets just like any
8 other program after you have done the following:
10 1) You MUST FIRST install the Java Developers Kit for Linux.
11 The Java on Linux HOWTO gives the details on getting and
12 installing this. This HOWTO can be found at:
14 ftp://sunsite.unc.edu/pub/Linux/docs/HOWTO/Java-HOWTO
16 You should also set up a reasonable CLASSPATH environment
17 variable to use Java applications that make use of any
18 nonstandard classes (not included in the same directory
19 as the application itself).
21 2) You have to compile BINFMT_MISC either as a module or into
22 the kernel (CONFIG_BINFMT_MISC) and set it up properly.
23 If you choose to compile it as a module, you will have
24 to insert it manually with modprobe/insmod, as kerneld
25 can not easy be supported with binfmt_misc.
26 Read the file 'binfmt_misc.txt' in this directory to know
27 more about the configuration process.
29 3) Add the following configuration items to binfmt_misc
30 (you should really have read binfmt_misc.txt now):
31 support for Java applications:
32 ':Java:M::\xca\xfe\xba\xbe::/usr/local/java/bin/javawrapper:'
33 support for Java Applets:
34 ':Applet:E::html::/usr/local/java/bin/appletviewer:'
35 or the following, if you want to be more selective:
36 ':Applet:M::<!--applet::/usr/local/java/bin/appletviewer:'
38 Of cause you have to fix the path names, if you installed the JDK
39 at another place than /usr/local/java.
41 Note, that for the more selective applet support you have to modify
42 existing html-files to contain <!--applet--> in the first line
43 ('<' has to be the first character!) to let this work!
45 For the compiled Java programs you need a wrapper script like the
46 following (this is because Java is broken in case of the filename
47 handling), again fix the path names, both in the script and in the
48 above given configuration string:
50 ====================== Cut here ===================
52 # /usr/local/java/bin/javawrapper - the wrapper for binfmt_misc/java
55 # if classname is a link, we follow it (this could be done easier - how?)
57 CLASS=`ls --color=no -l $1 | tr -s '\t ' ' ' | cut -d ' ' -f 11`
59 CLASSN=`basename $CLASS .class`
60 CLASSP=`dirname $CLASS`
64 if [ -z "`type -p -a $CLASSN.class`" ] ; then
65 # class is not in CLASSPATH
66 if [ -e "$CLASSP/$CLASSN.class" ] ; then
67 # append dir of class to CLASSPATH
68 if [ -z "${CLASSPATH}" ] ; then
69 export CLASSPATH=$CLASSP
71 export CLASSPATH=$CLASSP:$CLASSPATH
74 # uh! now we would have to create a symbolic link - really
75 # ugly, i.e. print a message that one has to change the setup
76 echo "Hey! This is not a good setup to run $1 !"
83 /usr/local/java/bin/java $CLASSN "$@"
84 ====================== Cut here ===================
87 Now simply chmod +x the .class and/or .html files you want to execute.
88 To add a Java program to your path best put a symbolic link to the main
89 .class file into /usr/bin (or another place you like) omitting the .class
90 extension. The directory containing the original .class file will be
91 added to your CLASSPATH during execution.
94 To test your new setup, enter in the following simple Java app, and name
98 public static void main(String args[]) {
99 System.out.println("Hello World!");
103 Now compile the application with:
104 javac HelloWorld.java
106 Set the executable permissions of the binary file, with:
107 chmod 755 HelloWorld.class
113 To execute Java Applets, simple chmod the *.html files to include
114 the execution bit, then just do
118 originally by Brian A. Lantz, brian@lantz.com
119 heavily edited for binfmt_misc by Richard Günther.