Results 1 to 4 of 4
- 02-11-2009, 10:42 PM #1
Member
- Join Date
- Feb 2009
- Posts
- 2
- Rep Power
- 0
Detecting software installed in PC
Hi everyone
Im trying to make a program that detects all the software installed in the computer, however i've got no clue where to start, i tried searching here and in google but didnt find anything about this topic (Perhaps i didnt use the correct keywords/search terms). so if anyone knows something or know where to find about it, that information will be most apreciated.
and for the curious.., im trying to develop this tool in order to be able to keep an inventary of my software vs my licenses, so my little company wont get in big troubles.
Lukalo
- 02-12-2009, 07:30 AM #2
Senior Member
- Join Date
- Jan 2009
- Posts
- 671
- Rep Power
- 5
There are already inexpensive commercial products that do this for you, but if you insist on writing one yourself, I probably wouldn't use Java since it has no hooks into the Windows API calls that give you this information.
However, you can exec the "reg query" command from java. Here is a crappy example with no error checking etc.
Java Code:import java.io.*; public class junk { public static void main(String[] args) throws Exception { String cmd = "reg query \"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft"+ "\\Windows\\CurrentVersion\\Uninstall\""; // This one will show you software categories installed //String cmd = "reg query \"HKEY_LOCAL_MACHINE\\Software\""; Process p = Runtime.getRuntime().exec(cmd); Thread.sleep(2000l); //terrible, the right way is p.waitFor //p.waitFor(); /* this command sometimes hangs on windows !!!???*/ InputStream in = p.getInputStream(); byte[] bytes = new byte[16384]; StringBuffer buf = new StringBuffer(); while(true) { int num = in.read(bytes); if(num == -1) break; buf.append(new String(bytes,0,num,"UTF-8")); } System.out.println(buf.toString()); p.destroy(); } }
- 02-12-2009, 02:07 PM #3
Member
- Join Date
- Feb 2009
- Posts
- 2
- Rep Power
- 0
@ Toadaly
Thanks for the code... it gave me some good hints at where to get started....
@ artonlinehome
???? it does?... well nothing happened here.... perhaps a Vista Bug?? XD
Anyway thanks for the help
- 02-13-2009, 03:04 AM #4
Senior Member
- Join Date
- Jan 2009
- Posts
- 671
- Rep Power
- 5
Similar Threads
-
Running a jar after it's installed
By Doctor Cactus in forum New To JavaReplies: 7Last Post: 01-20-2009, 11:08 AM -
Installed Certificate List
By mwalstra in forum Advanced JavaReplies: 0Last Post: 12-09-2008, 12:53 PM -
Getting Installed Look And Feels
By Java Tip in forum javax.swingReplies: 0Last Post: 06-26-2008, 07:45 PM -
java code for checking if a software is installed or not
By heggemony in forum Advanced JavaReplies: 1Last Post: 07-31-2007, 01:19 PM -
cannot find a JVM installed
By tommy in forum New To JavaReplies: 2Last Post: 07-29-2007, 08:23 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks