PDA

View Full Version : java in javascript


JPM
07-29-2005, 11:35 PM
Just noticed that you can use all(?...security) classes from the java api. Anyone heard of this before?

example

<script>

var s = new java.lang.String("test");
var t = new java.lang.String("test");

alert(s.equals(t));

var astring = "123 test test123";
var st = new java.util.StringTokenizer(astring);
while(st.hasMoreTokens()) alert(st.nextToken());

new java.awt.Frame("TEST").show();

// not working /*
var input = new java.io.BufferedReader(new java.io.FileReader("test.txt"));
var res = input.readLine();
alert(res); */

</script>

Mongus
07-30-2005, 01:16 AM
That's been in there for a LONG time (I saw it around '96) but it's almost never used. You can't depend on it because the browser may not have a JVM. Even if it does have a JVM it may be ancient.