ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/owl/trunk/tools/Machine.java
Revision: 492
Committed: Wed Jan 2 13:18:57 2008 UTC (17 years, 1 month ago) by duarte
File size: 1406 byte(s)
Log Message:
Copied the aglappe-jung branch into trunk.

Line File contents
1 package tools;
2
3 import java.net.*;
4 import java.util.Properties;
5
6 public class Machine {
7
8 public static String getClient() {
9 String client = "";
10 try {
11 client = InetAddress.getLocalHost().getHostName();
12 } catch (Exception e) {
13 System.err.println(e);
14 }
15 return client;
16 }
17 public static String getOSArch() {
18 return (System.getProperty("os.arch"));
19 }
20
21 public static String getOSName() {
22 return (System.getProperty("os.name"));
23 }
24
25 public static String getOSver() {
26 return (System.getProperty("os.version"));
27 }
28
29 public static String getUserName() {
30 return (System.getProperty("user.name"));
31 }
32
33 public static String getTempDir() {
34 return(System.getProperty("java.io.tmpdir"));
35 }
36
37 public static Properties getAllProperties() {
38 return System.getProperties();
39 }
40
41 public static long getTotalMemory() {
42 return Runtime.getRuntime().totalMemory();
43 }
44
45 public static long getFreeMemory() {
46 return Runtime.getRuntime().freeMemory();
47 }
48
49 public static void main(String[] args) {
50 System.out.println("Hi, I am " + getClient() + " and these are my properties:");
51 getAllProperties().list(System.out);
52 System.out.printf("Total memory: %,d bytes\n", getTotalMemory());
53 System.out.printf("Free memory : %,d bytes\n", getFreeMemory());
54 }
55 }
56

Properties

Name Value
svn:executable *