aspose file tools*
The moose likes Beginning Java and the fly likes Runtime.getRuntime().exec Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Runtime.getRuntime().exec" Watch "Runtime.getRuntime().exec" New topic
Author

Runtime.getRuntime().exec

Nagamani Srivastava
Greenhorn

Joined: Feb 02, 2009
Posts: 2
Hi All,

I am trying to open a file using Runtime.getRuntime().exec("cmd /C" + filepath). this doesn't work if I have brackets in the file name.
Say C:\My Workspace\Registry\ERPReports\ALV_Demo_Program_(Output_Simplest_version).csv

Can anyone help??

thanks & regards
Nagamani
Paul Michael
Ranch Hand

Joined: Jul 02, 2001
Posts: 697
Did you try escaping (add a slash \ before special characters) the braces?


SCJP 1.2 (89%), SCWCD 1.3 (94%), IBM 486 (90%), SCJA Beta (96%), SCEA (91% / 77%), SCEA 5 P1 (77%), SCBCD 5 (85%)
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 13868
    
  10

Welcome to JavaRanch.

You posted your question in the forum about the SCJA exam, but it looks like your question doesn't have anything to do with SCJA. I will move it to a more appropriate forum for you.

Please choose the appropriate forum when you post a question on JavaRanch.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Nagamani Srivastava
Greenhorn

Joined: Feb 02, 2009
Posts: 2
if we add escape char before (, then my path string becomes invalid.

Paul Michael
Ranch Hand

Joined: Jul 02, 2001
Posts: 697
Nagamani Srivastava wrote:if we add escape char before (, then my path string becomes invalid.



Ah sorry for that. Did you also try working on a directory name without spaces?
 
Consider Paul's rocket mass heater.
 
subject: Runtime.getRuntime().exec
 
Similar Threads
Calling script
How do I start MS Excel in Java?
Running OS Specific commands in Java
spaces in file name
running external commands in java