• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to find List of Programs installed ?

 
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

I need to find out, is it possible to create a list of all the programs installed on a machine using java?

Thanks in advance.

Regards
Roshini
 
Roshini Sridharan
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
some one could help to resolve the question !!!
 
Ranch Hand
Posts: 410
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think this question was asked quite recently, and the answer was probably that even if it is possible, it is very impractical (what exactly constitutes an 'installed' program; how does this vary with platform, etc).

If you are using Windows, there is probably a way with JNI to access the list of programs you see in the Add/Remove programs applet in the Control Panel.
 
Roshini Sridharan
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Thanx for the reply, Can i get an idea how i could use JNI to access the installed programs as it comes in control panel for windows.

Thanx in advance

Regards
Roshini
 
Stuart Gray
Ranch Hand
Posts: 410
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You will likely have to use the Windows API, which I am not familar with I'm afraid.
 
Ranch Hand
Posts: 1228
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Can i get an idea how i could use JNI to access the installed programs as it comes in control panel for windows



Java is platform independent.
But what you are trying to get is dependent to Windows platform.
My solution to this is, write a C++ or a VB Dll that returns the list of all programs installed in a windows machine.Now using JNI call this Dll and use the output of dll in your java code.I guess there is no way to retrive it directly from java.
Check this
tutorial..
[ July 16, 2005: Message edited by: Srinivasa Raghavan ]
 
Ranch Hand
Posts: 1923
Scala Postgres Database Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, of course the question has to be answered plattform-dependent, but in which way should someone not solve it with java?

The problem will be to define 'installed'.
 
Ranch Hand
Posts: 1071
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Stefan Wagner:

The problem will be to define 'installed'.



I think that would be the real question. For example, eclipse does not show up under my add/remove programs list, but it's probably the most used program on my computer.
 
Stuart Gray
Ranch Hand
Posts: 410
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The requirements of the program would also be useful here. Roshini, can you explain exactly why you need to do this, or what you want to achieve?
 
Roshini Sridharan
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

Thanx everybody for your ideas.

The requirement is i need to build a Desktop search that searches for the Development Tools supported and other softwares installed in my machine.

Regards
Roshini
 
Stuart Gray
Ranch Hand
Posts: 410
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ah, in that case things become somewhat easier. You can check for files with known names, and in known locations. Perhaps perform a CRC32 or similar of the file to ensure it is correct. Of course that might limit you to specific versions of the program.

Also, you could just take a much simpler approach and ask the user the location of the program's directory. This is what many IDEs do - e.g. when I installed JCreator, it detected the location of my JDK but presented the path to me as a text field so I could change it if I wanted to. Same for the location of the JDK docs. I think often this 'automated detection and install' type of thing can go wrong - and when it does, it often goes VERY wrong!
 
Roshini Sridharan
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi stuart,

I need something like this, if the user opts for searching the Java Development tools in my machine, my program should do a search of the JDK or any other tools available for java and should list the availability automatically, Hope you got the real idea now.

Regards
Roshini
 
Stefan Wagner
Ranch Hand
Posts: 1923
Scala Postgres Database Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
One way could be to read the variable 'JAVA_HOME'.

But developers often install multiple instances to
- ensure compatibility with old customer JREs
- ensure compatibility to old tools, not supporting newest JDKs (UML-tools, ...)
- have a mature JDK available
- have a bleeding-edge unstable pre-alpha-release for testing and lerning.

You could get the filesystem-roots (aka: drives), and recursivly walk them down to find a directory 'jre' to find all installed JDKs.

For users it would be helpfull to easily switch between different versions, and to specify different JDKs for different project, perhaps having a default jdk specified to start with.
 
Stuart Gray
Ranch Hand
Posts: 410
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Maybe, but to be honest it would really annoy me if the program stated recursing through my entire hard disk when I could just type in the full path of the JRE myself a lot quicker! I think you should present a textfield to enter the path manually, a browse button to open a file chooser to choose graphically, or another button to allow the 'autodetection' as described by stefan.
 
Blood pressure normal? What do I change to get "magnificent"? Maybe this tiny ad?
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic