/**Hello Norm thanks for your reply this code goes and gets the system info like cpu, memory and disks etc
*i am having trouble compiling the following code as the error reads, "Could not find or load main class", i know i am *supposed to have a main class in the code but where in my code can i define this main class i am using netbeans and *command prompt to compile the code but comes up with the error above and yes i also think its mentioning a main method *as well, but the above error is what i am coming up with
*/
[Code = java]
import java.io.File;
import java.io.IOException;
import java.text.NumberFormat;
public class GetInfo {
private Runtime runtime = Runtime.getRuntime();
public String OSname() {
String OSname = this.OSname();
return OSname.toString();
}
public String MemInfo () {
String MemInfo = this.MemInfo();
return MemInfo.toString();
}
public String DiskInfo () {
String DiskInfo = this.DiskInfo();
return DiskInfo.toString();
}
public String OSversion() {
return System.getProperty("os.version");
}
public String OsArch() {
return System.getProperty("os.arch");
}
public long totalMem() {
return Runtime.getRuntime().totalMemory();
}
public long usedMem() {
return Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory();
}
public void Memo() {
NumberFormat format = NumberFormat.getInstance();
long maxMemory = runtime.maxMemory();
long allocatedMemory = runtime.totalMemory();
long freeMemory = runtime.freeMemory();
System.out.println("Free Memory: " + format.format(freeMemory / 1024));
System.out.println("Allocated memory: " + format.format(allocatedMemory / 1024));
System.out.println("Max Memory: " + format.format(maxMemory / 1024));
System.out.println("Total free Memory: " + format.format((freeMemory + (maxMemory - allocatedMemory)) / 1024));
}
public void Os() {
System.out.println("OS name" + this.OSname());
System.out.println("OS version" + this.OSversion());
System.out.println("OS arch" + this.OsArch());
System.out.println("Available processors: " + runtime.availableProcessors());
}
public void DiskInf() {
/* Get a list of all filesystem roots on this system */
File[] roots = File.listRoots();
/* For each filesystem root, print some info */
for (File root : roots) {
System.out.println("File root path: " + root.getAbsolutePath());
System.out.println("Total space (bytes): " + root.getTotalSpace());
System.out.println("Free space (bytes): " + root.getFreeSpace());
System.out.println("Usable space (bytes): " + root.getUsableSpace());
}
}
}
[/code]