Code Samples

Java Operating System Identifier

2 Oct , 2007  

This old Java applet just lets you know what IP you are coming from and what OS and Java runtime you are using … in case you didn’t already know …

/*
os.java ver 1.1 (Final Release)

Barry  Wise, 10/24/97
Final Release 2/1/2000

This applet is freeware. For  minimal support and customizations, please contact
the author at  [email protected]

Source supported at:  http://www.barrywise.com/

*/

import  java.applet.*;
import java.awt.*;
import java.net.*;

public  class os extends Applet {

String sys = System.getProperty("os.name",  "Not Determined");
String arc = System.getProperty("os.arch", "Not  Determined");
String osv = System.getProperty("os.version", "Not  Determined");
String ver = System.getProperty("java.version", "Not  Determined");

InetAddress yourIPaddress = null;

public  void init()  {

setBackground(Color.white);

System.out.println("\n\nOS  ver 1.1 (Final Release)\n" +
"2/1/2000 by Barry Wise\n");

try  {
yourIPaddress = InetAddress.getLocalHost();
}
catch  (UnknownHostException e) {}
}

public void paint(Graphics g)  {

g.setColor(Color.black);
g.setFont(new Font("Helvetica",  Font.PLAIN, 12));

g.drawRect(1, 1, 200,  100);

g.drawString("You are using " + sys + " " + osv, 10,  15);
g.drawString("On a " + arc + "-class computer", 10,  30);
g.drawString("Your browser supports Java " + ver, 10,  55);
g.drawString("Your Local Address is: ", 10, 70);
g.drawString(" " +  yourIPaddress, 10, 85);
}

} // end os.java

, , , , , ,


Comments are closed.

Java Operating System Identifier

by Barry Wise time to read: 1 min
0