LizardKing
asked on
Getting System Information of server machine.... disk info. etc.
Hi
I have a JSP utility which runs on tomcat and also has a backend Java process which utilises a MySQL DB. Now I am building some pretty large tables of data. And I want to be able to check via the web server the space available on disk, I'd also like to check other things like memory usage and system start time etc.
Now the memory usage one I can get from the system class (along with OS etc. ) however I cannot find a way to get disk info.
Any help would be grrreeaaattt
cheers
LK--<
[ I have looked at jconfig and a few others but they are not what I want/need :( ]
I have a JSP utility which runs on tomcat and also has a backend Java process which utilises a MySQL DB. Now I am building some pretty large tables of data. And I want to be able to check via the web server the space available on disk, I'd also like to check other things like memory usage and system start time etc.
Now the memory usage one I can get from the system class (along with OS etc. ) however I cannot find a way to get disk info.
Any help would be grrreeaaattt
cheers
LK--<
[ I have looked at jconfig and a few others but they are not what I want/need :( ]
ASKER
That is a nice way of getting the info. however theres a few flaws in that this will only work on windows and what if there are multiple hard disks or the disk is not c: it is g: etc.
Cheers
LK--<
Cheers
LK--<
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I'm having a look at JConfig which I believe lets u do what I want its only $99 so its not too expensive , only thing is I cannot get it to work in my JSP :( , oh well I'll keep plugging at it
Oh you can have the points for your helpful comments
Cheers
LK--<
Oh you can have the points for your helpful comments
Cheers
LK--<
Process p = Runtime.getRuntime().exec(
BufferedReader br = new BufferedReader(new InputStreamReader(p.getInp
String line;
String freeSpace = "";
while ((line = br.readLine()) != null) {
if (line.indexOf("bytes free") > -1) {
int start = line.indexOf("dir(s)") + 7;
int end = line.indexOf("bytes free", start);
freeSpace = line.substring(start, end).trim();
break;
}
}
System.out.println("Free space: " + freeSpace);