how to launch a file (.txt file) upon clicking a button
hi,can anyone tell me how to make a file open ( local file) upon clicking a button .i mean within actionperformed() of that button , i want to write a code that launches a a text file.please tell me how to do this ,Thanks,vishal j
[272 byte] By [
vishal_vja] at [2007-11-26 14:55:58]

# 3
So in a native app then?There was a post a day or two in here which gave a code example. I just searched for it, but the search engine for these forums being the pile of incompetent dung that it is, I couldn't find it. It's there somewhere though :o)
# 4
I assume it is Windows. exec this:
String theFileToStart = "my.txt";
String toexec [] = new String[] { "cmd" , "/c" , "start" , theFileToStart };
# 5
well i tried this already & its not working.
I tried doing something like this
String filename = "C:\\Documents and Settings\\Administrator\\Desktop\\link.txt";
Runtime.getRuntime().exec(new String []{ "cmd", "/C" , "start" , filename});
after running this code , its bringing up a command prompt dialog on the desktop ,but actually i want the file to open up on the desktop.
Any help is appreciated
Thanks,
vishal
# 6
private static final String WIN_PATH = "rundll32";private static final String WIN_FLAG = "url.dll,FileProtocolHandler";..... File file = new File("file.txt"); Runtime.getRuntime().exec(WIN_PATH + " " + WIN_FLAG + " " + "\""+file.getAbsolutePath()+"\"");