summaryrefslogtreecommitdiffstats
path: root/Documentation/java.txt
blob: f5205b1a477cbe7bb07aa48da562b30eb6a4f6e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
               Java(tm) Binary Kernel Support for Linux v1.02
               ----------------------------------------------

Linux beats them ALL! While all other OS's are TALKING about direct
support of Java Binaries in the OS, Linux is doing it!

You execute Java classes as you would any other executable, after a few
small details:

	1) You MUST FIRST install the Java Developers Kit for Linux.
	   The Java on Linux HOWTO gives the details on getting and
	   installing this. This HOWTO can be found at:

		ftp://sunsite.unc.edu/pub/Linux/docs/HOWTO/Java-HOWTO

	   If you install the JDK in a location other than /usr/bin/java,
	   then you will need to tell the kernel where you put the Java
	   interpreter.  
           There are two ways to do this.
           One, edit fs/binfmt_java.c file and make the needed change to 
	   the _PATH_JAVA definition at the top of that file.  
           Two, as root, issue the command:
	 echo "/path/to/java/interpreter" > /proc/sys/kernel/java-interpreter
	   (Currently, this does not work if you're using a module for
	    Java support.)

	2) You must chmod the '*.class' files you wish to execute with
	   the execute bit. This is not normally (till now) done with
	   '.class' files.

	3) You must optionally export a CLASSPATH environment variable,
	   if you plan to use Java applications installed outside of
	   /usr/local/java/classes/*.

	4) Either compile your kernel with Java support builtin, or
	   as a loadable module. If a module, load it with insmod or
	   kerneld.

	5) A caveat.  When executing a java file, the java interpreter is
	   invoked only with the class name, not with the complete file path.
	   Therefore it is possible that the file the shell finds with PATH
	   is not the same file the java interpreter finds with CLASSPATH.
	   The recommended solution is to make symbolic links from a directory
	   in PATH to the actual class file in CLASSPATH, e.g.,
	   /usr/local/bin/myapp -> /usr/local/java/classes/myapp.class.

To test your new setup, enter in the following simple Java app, and name
it "HelloWorld.java":

	class HelloWorld {
		public static void main(String args[]) {
			System.out.println("Hello World!");
		}
	}


Now compile the application with:

	/usr/local/java/bin/javac HelloWorld.java

Set the executable permissions of the binary file, with:

	chmod 755 HelloWorld.class

And then execute it:

	./HelloWorld.class


Yes, it's JUST THAT EASY! ;-)

-----------------------------------------------------------------

Nope, I didn't forget about Java Applets! ;-)

While this may not be the best way to do this, it works!

Take any html file used with the Java appletviewer (like the
demo/Blink/example1.html file), and:

	1) Insert a new first line of:

		<!--applet-->

	   Make sure the '<' is the first character in the file. This
	   will be treated as a valid HTML comment outside of this
	   Java Applet support, so the modified file can still be used
	   with all known browsers.

	2) If you install the applet viewer in a location other than
	   /usr/bin/appletviewer, then you will need to tell the
	   kernel where you put the Java appletviewer.  
           There are two ways to do this.
           One, edit fs/binfmt_java.c file and make the needed change to 
	   the _PATH_APPLET definition at the top of that file.  
           Two, as root, issue the command:
	echo "/path/to/java/appletviewer" > /proc/sys/kernel/java-appletviewer
	   (Currently, this does not work if you're using a module for
	    Java support.)

	3) You must chmod the '*.html' files you wish to execute with
	   the execute bit. This is not normally (till now) done with
	   '.html' files.

	4) And then execute it.


Brian A. Lantz
brian@lantz.com
(/proc/sys/kernel/java-* support by Mike Shaver (shaver@ingenia.com))