Java(tm) Binary Kernel Support for Linux v1.01
|
Java(tm) Binary Kernel Support for Linux v1.01
|
----------------------------------------------
|
----------------------------------------------
|
|
|
Linux beats them ALL! While all other OS's are TALKING about direct
|
Linux beats them ALL! While all other OS's are TALKING about direct
|
support of Java Binaries in the OS, Linux is doing it!
|
support of Java Binaries in the OS, Linux is doing it!
|
|
|
You execute Java classes as you would any other executable, after a few
|
You execute Java classes as you would any other executable, after a few
|
small details:
|
small details:
|
|
|
1) You MUST FIRST install the Java Developers Kit for Linux.
|
1) You MUST FIRST install the Java Developers Kit for Linux.
|
The Java on Linux HOWTO gives the details on getting and
|
The Java on Linux HOWTO gives the details on getting and
|
installing this. This HOWTO can be found at:
|
installing this. This HOWTO can be found at:
|
|
|
ftp://sunsite.unc.edu/pub/Linux/docs/HOWTO/Java-HOWTO
|
ftp://sunsite.unc.edu/pub/Linux/docs/HOWTO/Java-HOWTO
|
|
|
If you install the JDK in a location other than the suggested
|
If you install the JDK in a location other than the suggested
|
directory of /usr/local/java, then you will need to tell the
|
directory of /usr/local/java, then you will need to tell the
|
kernel where you put the Java interpreter.
|
kernel where you put the Java interpreter.
|
There are two ways to do this.
|
There are two ways to do this.
|
One, edit fs/binfmt_java.c file and make the needed change to
|
One, edit fs/binfmt_java.c file and make the needed change to
|
the _PATH_JAVA definition at the top of that file.
|
the _PATH_JAVA definition at the top of that file.
|
Two, as root, issue the command:
|
Two, as root, issue the command:
|
echo "/path/to/java/interpreter" > /proc/sys/kernel/java-interpreter
|
echo "/path/to/java/interpreter" > /proc/sys/kernel/java-interpreter
|
(Currently, this does not work if you're using a module for
|
(Currently, this does not work if you're using a module for
|
Java support.)
|
Java support.)
|
|
|
2) You must chmod the '*.class' files you wish to execute with
|
2) You must chmod the '*.class' files you wish to execute with
|
the execute bit. This is not normally (till now) done with
|
the execute bit. This is not normally (till now) done with
|
'.class' files.
|
'.class' files.
|
|
|
3) You must optionally export a CLASSPATH environment variable,
|
3) You must optionally export a CLASSPATH environment variable,
|
if you plan to use Java applications installed outside of
|
if you plan to use Java applications installed outside of
|
/usr/local/java/classes/*.
|
/usr/local/java/classes/*.
|
|
|
4) Either compile your kernel with Java support builtin, or
|
4) Either compile your kernel with Java support builtin, or
|
as a loadable module. If a module, load it with insmod or
|
as a loadable module. If a module, load it with insmod or
|
kerneld.
|
kerneld.
|
|
|
To test your new setup, enter in the following simple Java app, and name
|
To test your new setup, enter in the following simple Java app, and name
|
it "HelloWorld.java":
|
it "HelloWorld.java":
|
|
|
class HelloWorld {
|
class HelloWorld {
|
public static void main(String args[]) {
|
public static void main(String args[]) {
|
System.out.println("Hello World!");
|
System.out.println("Hello World!");
|
}
|
}
|
}
|
}
|
|
|
|
|
Now compile the application with:
|
Now compile the application with:
|
|
|
/usr/local/java/bin/javac HelloWorld.java
|
/usr/local/java/bin/javac HelloWorld.java
|
|
|
Set the executable permissions of the binary file, with:
|
Set the executable permissions of the binary file, with:
|
|
|
chmod 755 HelloWorld.class
|
chmod 755 HelloWorld.class
|
|
|
And then execute it:
|
And then execute it:
|
|
|
./HelloWorld.class
|
./HelloWorld.class
|
|
|
|
|
Yes, it's JUST THAT EASY! ;-)
|
Yes, it's JUST THAT EASY! ;-)
|
|
|
-----------------------------------------------------------------
|
-----------------------------------------------------------------
|
|
|
Nope, I didn't forget about Java Applets! ;-)
|
Nope, I didn't forget about Java Applets! ;-)
|
|
|
While this may not be the best way to do this, it works!
|
While this may not be the best way to do this, it works!
|
|
|
Take any html file used with the Java appletviewer (like the
|
Take any html file used with the Java appletviewer (like the
|
demo/Blink/example1.html file), and:
|
demo/Blink/example1.html file), and:
|
|
|
1) Insert a new first line of:
|
1) Insert a new first line of:
|
|
|
|
|
|
|
Make sure the '<' is the first character in the file. This
|
Make sure the '<' is the first character in the file. This
|
will be treated as a valid HTML comment outside of this
|
will be treated as a valid HTML comment outside of this
|
Java Applet support, so the modified file can still be used
|
Java Applet support, so the modified file can still be used
|
with all known browsers.
|
with all known browsers.
|
|
|
2) If you install the JDK in a location other than the suggested
|
2) If you install the JDK in a location other than the suggested
|
directory of /usr/local/java, then you will need to tell the
|
directory of /usr/local/java, then you will need to tell the
|
kernel where you put the Java appletviewer.
|
kernel where you put the Java appletviewer.
|
There are two ways to do this.
|
There are two ways to do this.
|
One, edit fs/binfmt_java.c file and make the needed change to
|
One, edit fs/binfmt_java.c file and make the needed change to
|
the _PATH_APPLET definition at the top of that file.
|
the _PATH_APPLET definition at the top of that file.
|
Two, as root, issue the command:
|
Two, as root, issue the command:
|
echo "/path/to/java/appletviewer" > /proc/sys/kernel/java-appletviewer
|
echo "/path/to/java/appletviewer" > /proc/sys/kernel/java-appletviewer
|
(Currently, this does not work if you're using a module for
|
(Currently, this does not work if you're using a module for
|
Java support.)
|
Java support.)
|
|
|
3) You must chmod the '*.html' files you wish to execute with
|
3) You must chmod the '*.html' files you wish to execute with
|
the execute bit. This is not normally (till now) done with
|
the execute bit. This is not normally (till now) done with
|
'.html' files.
|
'.html' files.
|
|
|
4) And then execute it.
|
4) And then execute it.
|
|
|
|
|
Brian A. Lantz
|
Brian A. Lantz
|
brian@lantz.com
|
brian@lantz.com
|
(/proc/sys/kernel/java-* support by Mike Shaver (shaver@ingenia.com))
|
(/proc/sys/kernel/java-* support by Mike Shaver (shaver@ingenia.com))
|
|
|
|
|