Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Opening an excel File in java

Status
Not open for further replies.

ahsin

Programmer
Oct 1, 2003
8
US
Hi,
I want to open a particular excel file from java code. I am able to open the excel application , but not a particular file.Pls help.Its urgent

Thank U
 
try this:

Code:
try
{
   Runtime rt = Runtime.getRuntime();  
   rt.exec( "c:\\Program Files\\Microsoft Office\\Office\\Excel.exe c:\\test1.xls" );
}
catch (Exception ee) {}
 
Thank u Idarke for the response.....
i tried it but it doesnt work.
I get an error : CreateProcess (my file name) error=2
This is the same error i got earlier
Ahsin
 
Take a look at Thread269-639676

Instead of passing one (long) String to rt.exec(...) it passes a String[] (String array) to rt.exec(...)
 
error=2 is a "File not found" error. Check all your paths.

If you're still having trouble, post your code.
 
Thank u idarke ..and thank u hologram..
i ended up using holograms advice. But both suggestions were helpful. Tahnk u again....
Ahsin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top