The Artima Developer Community
Sponsored Link

Java Answers Forum
Question about the JAVA program

3 replies on 1 page. Most recent reply: Dec 21, 2003 9:34 PM by Matt Gerrans

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 3 replies on 1 page
shon

Posts: 42
Nickname: shon
Registered: Apr, 2003

Question about the JAVA program Posted: Dec 19, 2003 6:49 PM
Reply to this message Reply
Advertisement
as we know in our computer we have install a lot of different kind of software, eg: Microsoft word. winamp , etc

It is possible to use JAva to get The "list" of software and program that installed in our computer..

for eg:

the software intalled in our pc:
winamp
windows media player
office


java code return result:
the program intalled in your pc:
winamp
windows media player
office


FredrikN

Posts: 22
Nickname: fredrikn
Registered: Jul, 2003

Re: Question about the JAVA program Posted: Dec 21, 2003 3:33 AM
Reply to this message Reply
An quick and dirty way is to just print out foldernames from
C:\Program Files\.

import java.io.*;
 
public class Driver
{
	public static void main(String[] arg)
	{
		
		File f = new File("C:\\Program Files\\");
 
		if(f.isDirectory()) 
		{
			String[] files = f.list();
			
			for(int i = 0 ; i < files.length ; i++)
			{
				System.out.println(files[i]);
			}
		}
 
 
	}
 
}


And the output will be something like this:

BPFTP
mozilla.org
SuperGOO
Adobe
CoverPro
Winamp
Symantec
Norton Personal Firewall
Norton AntiVirus
WinZip
CyberLink

shon

Posts: 42
Nickname: shon
Registered: Apr, 2003

Re: Question about the JAVA program Posted: Dec 21, 2003 4:47 AM
Reply to this message Reply
Thank you very much, i have consider your way But some programs can be install at other folder..

Matt Gerrans

Posts: 1153
Nickname: matt
Registered: Feb, 2002

Finding Installed Programs Posted: Dec 21, 2003 9:34 PM
Reply to this message Reply
Essentially, there is no standard that is consistently followed with regard to this any of this, including using "Program Files." In fact, since some companies install several apps under their company name, under "Program Files" you will miss unless you look deeper. This isn't even considering the fact that "Program Files" is not the name of the directory in many non-English systems and "C:" isn't necessarily the home drive, as well as the fact (noted already) that a good number of applications don't install under program files. So really the problem is intractable. You could search for all exes on all drives, but even that is insufficient, since there are many other ways to run programs (bat files, com files, cmd files, class files, jar files, lnk files, py files, etc., etc., etc.).

One trick is to look under the Uninstall key (HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall), but this also has many drawbacks, including the fact that some installers don't populate it and some leave it orphaned after the app has been uninstalled (this is pretty common). Also, you can't access that key when you are running under a "limted" (non-administrator) user account, so it isn't 100% guaranteed that you'll always be able to use that.

There are programs like virus scanners that check what software you have installed, but I think they just maintain a huge manifest of things they know (including multiple versions of different apps, since vendors invariably discover new and interesting ways to install themselves with each release), so they end up missing things they don't already know about (or flagging them as "bad," or "possibly bad," or whatever silly thing they decide to do).

Flat View: This topic has 3 replies on 1 page
Topic: Entity Expansion in JDOM Parser Previous Topic   Next Topic Topic: URGENT Help With Scientific Calculator!

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use