JAVA code to create file in Linux with specific permission

Hi All,

I'm looking for JAVA code to create file in Linux with specific permission

File should be created and saved in Linux in this path \opt\sys\doc by Java with this permission 764

Anyone can help to provide this Java code

There is a generic system call for that, fopen() . Have a look at its man page and report back if anything in there is unclear.

First off, i'd like to question the rationale behind 764. That would mean to give execute rights to the owner and i would be quite surprised if you would want to create an executable.

Second, the path: "\opt\sys\doc" is not a path but rather a filename. Since you do not need to escape regular characters you could also write "optsysdoc" to the same effect. So, what is the path?

I hope this helps.

bakunin

\opt\sys\doc this is the path and files will be created under that path

Im new in Java and i want your help to have the code if you can help me

You might want to start by reading the JAVA API documentation of File class:
File (Java Platform SE 7 )