views:

76

answers:

3

I want to develop an application that can retreive information such as, DLL version, DLL build mode(debug or release), info. regarding OS, memory, processer, processes/threads, program version etc. I am developing this mainly for Windows, but it'd be good if the application supports Linux too(wherever applicable).

I am basically a java programmer, and I know C, C++ to some extent.

Which programming language should I go for, that'd make my job easy? i.e. which language has APIs to fetch these kind of information? Please suggest.

+1  A: 

Well... APIs are available regardless of the language... But the easiest way to get at what you are trying to do is going to be a C or C++ app. That doesn't mean it'll be easy (getting a DLL version is easy, getting memory and processor type is easy. The other stuff is certainly possible, but you may have to roll up your sleeves and learn the win32 API).

You might want to take a look at an application that already does exactly what you are asking about (Process Explorer) before you try to develop this yourself... It's going to be a big undertaking - and the folks at Sys Internals are really, really good at this stuff, and have already done it.

Kevin Day
Hi Kevin, thanks for answering. I just wanted to know if with Java my chances of going about this task become even more diffcult comparatively. Because not only do I prefer Java, but also that when it comes to Win API and stuff I am totally blank.
Chandan .
nope - doing this from Java will be significantly harder than just doing it in C. That said, if there are parts of your app that are suited to Java (the UI, socket interaction, multi-threading, etc...), you could certainly do a combination - write the low level stuff in C, then use JNI to bridge that to Java. We do this in several of our applications. But now you are talking about learning C and JNI - plus the Win32 API (which you are going to have to learn no matter what for what you are trying to do).
Kevin Day
A: 

Since DLLs are mentioned I presume we are talking about Windows. I would recommend using WMI queries. They look very much like SQL and give you access to many very useful classes. e.g. all info about the OS can be found here - in W32_OperatingSystem: http://msdn.microsoft.com/en-us/library/aa394239%28VS.85%29.aspx You can use WMI classes from any language including C++. As a side note - if you start a new application from scratch consider using PowerShell - new scripting language from Microsoft.

DmitryK
+1  A: 

You commented on Kevin Day's answer that you would prefer to use Java for this.

Java is not very well suited for this, because the information you want to get is very platform-specific, and since Java is designed to be platform-independent, there are not a lot of ways to get at this kind of information from Java.

There are some methods in classes java.lang.System and java.lang.Runtime to get information about the platform that your Java program is running on. For example, class Runtime has a method availableProcessors() that tells you how many processors are available to the Java virtual machine. Note that this is not the same as the number of processors (or cores) that exist in the computer; the documentation even says that the number may change while the program is running.

Lookup the documentation for java.lang.System and java.lang.Runtime for more information.

Most likely you're not going to get exactly the information that you need by using pure Java - C or C++ will be better suited to get this kind of platform-specific information. If you would need this information from a Java program, you could write a small DLL or shared library and use JNI to call into it from your Java program.

Jesper
Very much along the lines that I was thinking when I thought about using Java. nice explaination though. +1!
Chandan .