Creating small combobox which works as "Run" in windows

I have to create a combobox such that when i add new item to combobox and press enter, it should open that application.

Like if i give %notepad% it should open notepad and %notepad% should be a environment variable.

and if enter "my_csv.file" it should open that file by finding the path of the file.

please help out me

[345 byte] By [Sailu01a] at [2007-11-26 17:43:49]
# 1
nobody can help you if you don't ask a specific question.
Jasprea at 2007-7-9 0:12:01 > top of Java-index,Desktop,Core GUI APIs...
# 2

For running or executing checkout Runtime.exec();

Since it uses windows shell env variables will be available implicitly (as much as I think)

For programming such a thing. for searching the file etc...you will have to do that. if your asking for a code...that is too much to ask, don't you think?

DhruvaSagara at 2007-7-9 0:12:01 > top of Java-index,Desktop,Core GUI APIs...
# 3

hello,

Thanks.

i am not asking for code.

even i tried working out this, i am facing problem.

i have created some enivronment varaiables and tried using this Runtime.exec, its only working for notepad and not for other applications.

If i try to enter file name, I am able to find the path of that file but unable to run the application(i have to open that file such that users can viwe file contents). This stuff is working for notepad alone. wht to do if i wanna open excel,.csv files.

Sailu01a at 2007-7-9 0:12:01 > top of Java-index,Desktop,Core GUI APIs...
# 4

Well since you mentioned environment variables i assumed you have an understanding of them...

Anyways notepad is working because notepad.exe is situated in the windows folder which is there in the 'path' environment variable.

Now when you execute any command (executable to be precise in windows), the shell searches for their binaries in the folders that are specified in the environment variable 'path' so since notepad is there in the windows directory which is there in the path variable it finds it and hence is able to execute it.

For other executable programs be it anything, for them to be executed either you need to explicitly specify their path / location where it is.

using Runtime.exec(c:\...\excel.exe) or u may set the path variable before trying to execute something using

Runtime.exec("set path=%path%;append_your_path_of_the_containing_directory_here");

and then after that you simply need to call the application directly in Runtime.exec();

DhruvaSagara at 2007-7-9 0:12:01 > top of Java-index,Desktop,Core GUI APIs...
# 5
http://forum.java.sun.com/thread.jspa?forumID=57&threadID=631279
camickra at 2007-7-9 0:12:01 > top of Java-index,Desktop,Core GUI APIs...