Re: How to make a file "executable" at runtime?
From: Anthony Borla (ajborla_at_bigpond.com)
Date: 02/23/05
- Next message: Andrei: "Verification of signed jars in J2SE"
- Previous message: unkwb_at_web.de: "AXIS jars org.apache.axis.wsi.* and org.apache.axis.transport.jms.*"
- In reply to: bfische: "How to make a file "executable" at runtime?"
- Next in thread: bfische: "Re: How to make a file "executable" at runtime?"
- Reply: bfische: "Re: How to make a file "executable" at runtime?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 23 Feb 2005 16:08:50 GMT
"bfische" <fischelbruno2@hotmail.com> wrote in message
news:1109131163.156740.268830@z14g2000cwz.googlegroups.com...
> I am creating a script file in some Java class.
>
Dynamic programming at it's best ;) !
>
> I want to change its permission so it can be executed
> using Runtime.exec().
>
See below regarding file permissions.
>
> I have tries to create a new FilePermission for this file and
> then use:
>
> AccessController.checkPermission(myFilePermission) but
> I get an AccessControllerException with access denied.
>
> Is it possible to give my file the execute permission with
> Java (I would like to avoid having to run a chmod)?
>
The FilePermission 'execute' permission simply allows 'Runtime.exec' to
launch the nominated file [which should be a binary executable]. It is
something which is applicable only within the Java environment, and has
nothing to do with *NIX file permissions.
So the answer is: no, you cannot use a standard Java class to directly
perform this task. You will need to use 'chmod', either in command form,
executed via 'Runtime.exec()', or in function form, via a JNI wrapper.
I hope this helps.
Anthony Borla
- Next message: Andrei: "Verification of signed jars in J2SE"
- Previous message: unkwb_at_web.de: "AXIS jars org.apache.axis.wsi.* and org.apache.axis.transport.jms.*"
- In reply to: bfische: "How to make a file "executable" at runtime?"
- Next in thread: bfische: "Re: How to make a file "executable" at runtime?"
- Reply: bfische: "Re: How to make a file "executable" at runtime?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|