LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-20-2014, 03:09 PM   #1
reza_zah1991
Member
 
Registered: Mar 2013
Location: Qom , Iran
Distribution: opensuse,lubuntu
Posts: 32

Rep: Reputation: Disabled
Thumbs down File with Default Execution Permission


hi folks
i have java programm that create a file
application needs exexution & Write permission for file
but in linux files have not a execution Permission by default


how can i configure the linux to creat a file with execution permission by default.. ???

thanks to all
 
Old 08-21-2014, 12:14 AM   #2
cliffordw
Member
 
Registered: Jan 2012
Location: South Africa
Posts: 509

Rep: Reputation: 203Reputation: 203Reputation: 203
Hi there,

As far as I know there is no way to set execute permission by default on a newly created file. You might be able to change the permissions from within your Java program after creating it, though. Which version of Java are you using? In Java 7, try setPosixFilePermissions() in the java.nio.file class.

Out of curiosity, any particular reason you need execute permission? This is an unusual requirement. What files are you creating that need this?

Regards,

Clifford
 
1 members found this post helpful.
Old 08-21-2014, 12:42 AM   #3
reza_zah1991
Member
 
Registered: Mar 2013
Location: Qom , Iran
Distribution: opensuse,lubuntu
Posts: 32

Original Poster
Rep: Reputation: Disabled
cliffordw

i am writing a project under cloud Computing Design,,
and admin user can add new function to the server and i want to compile the function before adding to the server
in linux when we create a file,, execution permission is not as default, for this reason i cant run the file for compile

setPosixFilePermissions() did worked..

thanks man..
 
Old 08-21-2014, 12:47 AM   #4
reza_zah1991
Member
 
Registered: Mar 2013
Location: Qom , Iran
Distribution: opensuse,lubuntu
Posts: 32

Original Poster
Rep: Reputation: Disabled
Thumbs down

at last i have a question

this Solution "Set<PosixFilePermission> perms = new HashSet<PosixFilePermission>();"
is a OS Dependence or is universal Solution and work all right in all Operation System ????
 
Old 08-21-2014, 02:03 AM   #5
cliffordw
Member
 
Registered: Jan 2012
Location: South Africa
Posts: 509

Rep: Reputation: 203Reputation: 203Reputation: 203
Quote:
Originally Posted by reza_zah1991 View Post
at last i have a question

this Solution "Set<PosixFilePermission> perms = new HashSet<PosixFilePermission>();"
is a OS Dependence or is universal Solution and work all right in all Operation System ????
This works only on POSIX-compliant systems. This means it will work on Linux, most other UNIX systems, etc, but not on Windows.
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Can I set default file/directory permission levels? toes Linux - Security 5 01-05-2007 06:21 PM
Regarding default uploaded file permission in apache chandramani Linux - General 0 03-23-2006 09:11 AM
umask and default file permission cool9292 Linux - Newbie 2 03-10-2006 07:03 PM
SU/program execution permission problems darin3200 Linux - Software 8 08-20-2005 10:03 PM
script execution - file/directory permission issue serksimper Linux - Enterprise 1 08-10-2005 03:01 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:42 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration