GetRuntime().exec("chmod 777 a file.txt") - does not do the intended task

Hi,
I am trying to change the permissions of file (file name has spaces) using the Runtime.getRuntime().exec() method on AIX platform. My sample code is -
import java.io.*;
public class ChangeMode
     public static void main(String[] args)
          Process p = null;
     String cmd = null;
          cmd = "chmod " + "000" + " " + "a file.txt";
          try
          p = Runtime.getRuntime().exec( cmd );
          p.waitFor();
          catch( Exception e )
          e.printStackTrace();
          System.out.println("The exit value "+p.exitValue());
In this case - I am getting exitValue of 2.
But, the strange part is that - I am able to run the command
"chmod 000 a file.txt "
from the command prompt successfully.
Any ideas what does an exitValue of 2 means and where is this program getting failed.
Thanks!
~Saurabh

Is 'a file.txt' the file name ?
If I'm right, the Runtime.exec(String cmd) method will split the given string (using spaces.)
The first token will be used a the command and the other ones as the arguments.
In your example it will call chmod with three arguments: 000, a and file.txt
In order to avoid that, you should either use the Runtime.exec(String[] cmd) method with: String[] cmd = new String[] {"chmod", "000", "a file.txt"};or try to put your file between ticks: String cmd = "chmod 000 'a file.txt'";You could have a look at this article to learn more about Runtime.exec() :
http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html
I hope it will help.

Similar Messages

  • "file.txt" does not exist, or file is empty; you cannot upload empty files

    All,
    I am trying to upload a file in Content Management --> Explorere --> 'Public Document' and get the following error "file.txt" does not exist, or file is empty; you cannot upload empty files.
    We have a EP 2004s install.
    Any thoughts would be appreciated.
    SAP Partner

    Try have a look at the following note: 898637: Upload to KM does not work
    <a href="https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes/sdn_oss_ep_km/~form/handler%7B5f4150503d3030323030363832353030303030303031393732265f4556454e543d444953504c4159265f4e4e554d3d383938363337%7D">Upload to KM does not work</a>
    The error seems to be related to a problem with writing into the directory for temporary data.

  • Acrobat Pro "save as" function in the file menu does not show the current directory of the file

    I have installed CC but Acrobat Pro gives me headaches.
    The "save as" function in the file menu does not show the current directory of the file but something I have worked on in the past.
    It forces me to navigates through my hard disk for this very straightforward thing in normal conditions. I precise: Acrobat is the only software reacting like that.
    I use Windows7 professional 64bits.

    I use what seems to be the latest version available on the Cloud:
    To illustrate my point, I open a directory with explorer and double-click on the only PDF in there:
    So here it is, open:
    When I do a "Save as", it takes me to a totally different place on the disk!
    Very annoying...
    Thanks for your time!
    JJ

  • File name does not showing the InDesign icon?

    I have got few files from my client and they said it is an InDesign CS2 version file. but the file name does not showing the InDesign icon on the file name, though I have CS2 and I have tried other version too.
    Also I could not open the file in any version.
    Can somebody help me?

    there is no screen shot...
    You must either post a link to it on another server or embed it into a post using the camera icon on the web page like this:

  • Using Firefox 3.6.20 and Windows XP Home SP3. Firefox sporatically deletes bookmarks from the bookmarks toolbar. Additionally, when I try to import from a saved HTML file, Firefox does not import the complete file. Results are inconsistent.

    Using Firefox 3.6.20 and Windows XP Home SP3. Firefox sporatically deletes bookmarks from the bookmarks toolbar. Additionally, when I try to import from a saved HTML file, Firefox does not import the complete file. Results are inconsistent.

    A possible cause is a problem with the file places.sqlite that stores the bookmarks and the history.
    *http://kb.mozillazine.org/Bookmarks_history_and_toolbar_buttons_not_working_-_Firefox

  • When I try to click on a download link for a .pdf file Firefox does not recognize the MIME type and tries to download the file as "index.php"

    When visiting a site I frequent I tried to download a linked .pdf file. Previously I've used Firefox 7.0.1 to download the link with no problem. Using Firefox 8 however I the browser does not recognize the .pdf link's mime type. Instead of recognizing the download link as a .pdf file Firefox 8 tries to download it as "index.php". Firefox 8 does this with .doc files and .txt files as well. When I downgrade to 7.0.1 again the problem disappears.

    Hi hakmacpace,
    I'd try starting Firefox in [[Safe Mode]]. If you don't have the issue while all of your add-ons, extensions, and themes are disabled, you can try adding them back in one by one until you find the culprit. You should look at the [https://support.mozilla.org/en-US/kb/Troubleshooting-extensions-themes Extensions and Themes troubleshooting guide ] and the [[Troubleshooting plugins]] article as well.
    You could also try [https://support.mozilla.org/en-US/kb/Managing-profiles?s=create+a+new+profile&r=2&e=es&as=s#w_creating-a-profile Creating a new profile].
    Hopefully this helps!

  • Unlock a FM file that does not have the Read-only attribute?

    I have FrameMaker 8.0p277. I was trying to import formats from a file on my network. Everything froze. I had to reboot. When I reopened my FM book file and the individual chapter files, I got the lock message that prompted me to reset the lock and open each file. I did that--opened each file and reset the lock in each file. However, when I go to update my files, I get a message that one of my files is read-only. The attribute settings does not say this. I also can't even click in this file any more. I tried removing it from my book file and adding it back in. But that didn't change anything. Is there a way to get this file unlocked again?

    This happened to us once.
    Be sure you are pressing the keys sequentially, except for F, that is:
    Esc
    Shift+F
    l
    c
    Except for Shift+F, do not press all the keys at the same time.

  • File Adapter does not process the same file twice

    SOA: 11.1.1.4 (non-HA).
    I have a file adapter that triggers when a new file gets to a directory; the file is not deleted after the process triggers.
    The process is supposed to call other services via a mediator and if any remote fault happens it should rollback automatically and re-trigger with the same file at the next polling interval.
    I have literally 3 scenarios:
    1). The file gets picked up once, the process fails and the file is never picked up again.
    Msg in log: The file : /xx/xx/xx/abc.xml is being ignored as it has already been processed
    2). If the mediator only routes to one service after the file gets picked up, it works as expect (that is rollback and restart at the next polling interval). If it has more than one sequential routing rule, I see the same error as above.
    3). File does not get picked up EVEN if I "touch" or rename the file.
    Msg in Log:
    File Adapter ProcessName Poller enqueuing file for processing :/xx/xx/xx/abc.xml
    File Adapter ProcessName Ignoring File : abc.xml as it is already enqued for processing.
    I have already checked, there is no permission issue.
    This is what my .jca file looks like:
    <adapter-config name="getFile" adapter="File Adapter" wsdlLocation="getFile.wsdl" xmlns="http://platform.integration.oracle/blocks/adapter/fw/metadata">
    <connection-factory location="eis/FileAdapter" UIincludeWildcard="*"/>
    <endpoint-activation portType="Read_ptt" operation="Read">
    <activation-spec className="oracle.tip.adapter.file.inbound.ScalableFileActivationSpec">
    <property name="DeleteFile" value="false"/>
    <property name="MinimumAge" value="5"/>
    <property name="SingleThreadModel" value="true"/>
    <property name="PhysicalDirectory" value="/xx/xx"/>
    <property name="Recursive" value="false"/>
    <property name="PollingFrequency" value="20"/>
    <property name="IncludeFiles" value=".*"/>
    <property name="UseHeaders" value="true"/>
    <property name="MaxRaiseSize" value="5"/>
    <property name="ListSorter" value="oracle.tip.adapter.file.inbound.listing.TimestampSorterAscending"/>
    </activation-spec>
    </endpoint-activation>
    </adapter-config>
    Thanks for looking into it in advance.
    Any help with the error messages will be appreciated.

    You have to use MOVE operation, if there is any remote exception occured, then move the file to someother folder and again move back to the same folder where the file pickup will start.
    In that way you will be use the same file picked up next time when the polling happens.
    It is considered good etiquette to reward answerers with points (as "helpful" - 5 pts - or "correct" - 10pts).
    Thanks,
    Vijay

  • I've downloaded pages 4.1 onto my new macmini (10.7.2) but the File menu does not include the save as function .  Any suggestions?

    I've just downloaded Pages 4.1 onto my new macmini (OS X 10.7.2 Lion) but the "Save as ..." function does not appear in the File menu (although "Save ..." does appear).  I'm wasting lots of time saving copies and then changing the names via the desktop.  Any suggestions?  I've already checked updates and can't see any that look suitable.
    Whoops!  No sooner had I posted this as a question when a whole host of queries popped up asking the same Q.  So now I know there is NO Save as in Pages 4.1, but a similar route using Duplicate.  I'm off to experiment.
    Plus ça change!!!

    I've just downloaded Pages 4.1 onto my new macmini (OS X 10.7.2 Lion) but the "Save as ..." function does not appear in the File menu (although "Save ..." does appear).  I'm wasting lots of time saving copies and then changing the names via the desktop.  Any suggestions?  I've already checked updates and can't see any that look suitable.
    Whoops!  No sooner had I posted this as a question when a whole host of queries popped up asking the same Q.  So now I know there is NO Save as in Pages 4.1, but a similar route using Duplicate.  I'm off to experiment.
    Plus ça change!!!

  • 10.4.9 ::: Renaming files / folders does not work the GUI way

    Hi,
    just realized a strange problem on an Mac Mini (10.4.9) here.
    The installation contains 3 user-accounts
    Problem only occurs for one of those three accounts
    Description:
    - If the user tries to rename a file via
    a) mouse click on the name or
    b) get info dialog
    the folder/file name gets marked as supposed
    BUT it looks like all keyboard input is ignored at all.
    That results in the point that this special user-account is unable to
    rename any file/foldername.
    All files i have tested display correct ownership in the GetInfo dialog.
    Rename works without problems if i am using Terminal.app and the MV-command.
    Based on that i assume that the ownership & permissions are correct.
    All other user-accounts do act like suppoed regarding renaming etc...
    Is that a common bug under certain cases ?
    Can you provide me any solution for that problem / bug ?
    Can i offer any additional information to help debugging this problem ?
    best regards
    fidel

    Ok i realized the MacMini is usualy not shutdown at the evening.
    So i guess this special Mac was running/sleep/running for several month now.
    Maybe just a strange-side-effect of that nig uptime...anyway its a bug.
    A Restart fixed that problem now for this time, but according to some other threads / discussions i have found during my research it seems like its a known problem in general
    I am still interested if there is a real work-around ofr that issue
    Best regards
    fidel

  • The log file behavior does not follow the logging preferences I set

    I set my log file parameters to capture a large amount of information.
    Specifically, I wanted to capture log files as big as 1GB and keep them
    for 3 sets of backups. The settings I used are as follows:
    <P>
    logfile.http.maxlogfilesize 1073741824
    logfile.http.maxlogsize 4294967296
    <P>
    However, after setting these values, I can see only two log files, the file
    for today and the file for yesterday.
    (See attachment)

    I've given full read and write privileges
    To whom? And as whom are you connecting?

  • Iphone 4 file size does not match the ACTUAL file size

    My iphone 4 is reading 27 gigs of music as over 29 gigs of music. I don't understand why. Anyone else having an issue like this? My 3gs reads it as 27 gigs and so does my computer. I even set my 3gs to sync off a backup of my iphone 4 and it reads it as 2 less gigs. Why?

    Don't know, though Apple has been known to play with the numbers a bit:
    http://www.tuaw.com/2009/08/29/snow-leopard-the-new-one-gigabyte-now-slimmer-tha n-before/
    Or you could have had a conversion box checked in iTunes when you loaded your IPh4
    Phil

  • KDE open file dialog does not honor the global double click setting

    I have checked both in system settings and in the file
    $HOME/.kde/share/config/kdeglobals
    to make sure the singleclick is set to false. Still in the open/save dialog the files are selected and opened in a single click.
    This bug is not seen in chakra linux (which now has kde 4.8.2).
    Anyone can confirm this?
    Last edited by tzhang37 (2012-04-20 16:38:37)

    It works for me.

  • When I save a bank statement as a text file or spreadsheet file it does not convert the transactions but does the rest?

    The header showing the bank name and the account details and the conditions are done and the end balance is done and the footer information but the middle is ignored.

    Dear cor-el, wow you are quick. I understand you better now, but I'm not sure it's a good idea to write to you in dutch, only if you are Dutch yourself.
    Anyway, first the location bar is what I call the address bar.
    Second I work very simple and easy. I never use the address bar when I'm looking for a website.
    I just type the name of whatever I'm looking for in the empty bar on my google page and wait for the response.
    Third, most of the sellers I buy from on ebay, I just discovered by accident and I immediately saved them in my favorites bar.
    So if I need to go to their website(s) I just go to my favorites bar and click on the name of the seller(s) I'm looking for.
    Now to answer the question from your earlier letter, the URL's I'm trying to save are those from the webpage(s) I open on the websites I visit and not from the website(s) itself.
    The second part of your last letter from " You can modify......" is too difficult for me to understand.
    If it's important I'll ask a friend, a mainframe specialist to explain it to me.
    Thanks again for help. Regards, Ruiz

  • The answer provided does not accomplish the rrequired task

    I asked for help to remove mystart search engine - I did get a comprehensive reply- however none of this has removed the search engine. I continues to be the page on which my firefox opens - please provide further assistance to rid my computer of the unwanted rubbish.
    Thank you

    You should say this in the thread instead of making a new thread as a reply. https://support.mozilla.org/en-US/questions/1026522

Maybe you are looking for

  • COLD REST ON LASERJET 2100 WITH JETDIRECT 600

    i HAVE TRIED A COLD RESET BUT IT DOES NOT SEEM TO RESET THE JETDIRECT CARD. THE PROCESS I USED WAS TO HOLD DOWN THE JOB CANCEL KEY AND THE TURN ON THE PRINTER, AFTER ALL LIGHT ARE ON I RELEASE THE JOB CANCEL KEY AND LET IT DO ITS THING.  wHEN I PRINT

  • HP Color Laserjet 8500dn Printer Supplies

    Hello, Does anyone know if HP has stopped production on the Color Laserjet 8500 supplies such as: C4149A Black Toner C4150A Cyan Toner C4151A Magenta Toner C4152A Yellow Toner C5153A Image Drum Kit C5154A Transfer Kit C4155A Fuser Kit I have searched

  • Parent child tables - how to maintain RI

    Here is my scenario: In our model, we have parent child relationship between tables. We are not sure how the parent tables are populated. If incremental update, it should be fine (assuming if needed rows will be inserted in the child table manually).

  • Many channels missing/not loading

    Many of my SD and HD are not loading or are missing. When I tune to the channel I get a blank screen which eventually kicks to a verizon service agent screen that "checks for blackouts" and then comes back to tell me the channel is not available. Thi

  • How to locate files

    Hello, I am new to Aperture, I am trying to keep all my pictures on an external drive connected to my iMac, in addition work on them via share with my MacBook. My question is how do I verify within Aperture of the location of an entire Project or a i