Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: chmod
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: chmod



taiga wrote:

I have a problem about "chmod" command.


I am trying to execute chmod command using java.lang.Process,

for example:


Process process = Runtime.getRuntime ().exec (

new String [] {

"chmod",

"g+w",

"/あいうえお.txt"

}

);


but chmod command doesn't recognize NON-ASCII characters. Even if I

give NON-ASCII-ESCAPED characters like

/\343\201\202\343\201\204\343\201\206\343\201\210\343\201\212.txt ,

it doesn't work.


Does anyone know a collect way?


Does chmod work with this file when invoked from a Terminal window? Runtime.exec is a bit different, in that the input is not run through a shell (Terminal uses the bash shell by default). If it works from Terminal, try exec-ing a shell command, e.g.

    new String[] {
        "/bin/csh", "-c", "chmod g+w '/xxxxx.txt'"
    }

The shell's locale would need to be set. I expect that Terminal would do that automatically, I'm not so sure about exec-ing a shell. The csh man page also talks about using the ISO 8859-1 character encoding when not using the system natural language support, Java's String class will normally use the default encoding (MacRoman), which is another possible source of problems.
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.