LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-27-2005, 03:57 PM   #1
Diederick
LQ Newbie
 
Registered: Apr 2005
Posts: 25

Rep: Reputation: 15
Opening files


I opened another program from within my java program, now i want to send this new program the file i want it to open. I uesd the JFilechooser to get the file but how do i send that file to the newly opened program?

Thanx
 
Old 06-27-2005, 04:04 PM   #2
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Ubuntu
Posts: 8,507

Rep: Reputation: 125Reputation: 125
You'll need to pass that data BEFORE launching the other application, probably as an argument to the application.
 
Old 06-27-2005, 04:09 PM   #3
Diederick
LQ Newbie
 
Registered: Apr 2005
Posts: 25

Original Poster
Rep: Reputation: 15
replay

Yes i'll pass the file as arguments but how do i pass the program anny arguments?
 
Old 06-27-2005, 04:10 PM   #4
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Ubuntu
Posts: 8,507

Rep: Reputation: 125Reputation: 125
What code are you currently using the launch the program?
 
Old 06-27-2005, 04:33 PM   #5
Diederick
LQ Newbie
 
Registered: Apr 2005
Posts: 25

Original Poster
Rep: Reputation: 15
Runtime runEnviron = Runtime.getRuntime();

try {
Process burnProcess = runEnviron.exec("C:\\Program Files\\Adobe\\Acrobat 6.0\\Reader\\AcroRd32");
}

catch (IOException e) {

System.out.println("Problem!");

}

This is the code i'm using to load the program, now i want to send the program the file it sould open.
 
Old 06-27-2005, 09:11 PM   #6
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Ubuntu
Posts: 8,507

Rep: Reputation: 125Reputation: 125
have you tried placing the argument after the AcroRd32?
Code:
 runEnviron.exec("... FILENAME");
That's how it would work at the shell level, anyway. Not sure how exec on a Runtime works, though according to the article at http://www.javaworld.com/javaworld/j...29-traps.html, it should work.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Opening .db files m123 Linux - Newbie 3 09-29-2005 05:51 PM
opening files... hoffman Linux - Newbie 10 11-13-2003 01:24 PM
opening files w/ apps phantom4 Linux - Software 2 09-20-2003 10:10 PM
opening files in their programs hamish Linux - Newbie 2 09-07-2003 02:35 PM
Opening Apple files Jasutinsama Linux - Newbie 1 02-06-2001 01:35 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:26 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration