javascript - Linux write to file from java jar -


i writing text file java jar executable. jar generates correct file permission of file set root, therefore other javascript cannot read file. returns "permission denied" when attempt read file via ajax. how can fix issue when creating file in java? running java 1.6.

i did not have issue when running application within eclipse. once ported on jar permission changed root access.

i running jar a

exec('java -jar writetofile.jar'); 

the writing file standard

public void writecontents(string fp,string contents){     try{         bufferedwriter write = new bufferedwriter(new filewriter(fp));         write.write(contents);         write.close();     }catch(exception e){         system.out.println("failed write file " + fp + " error: " + e.tostring());         e.printstacktrace();     } } 

writing file works fine, creates file correct directory , desired data, difference between running in eclipse , running via jar file permission. jar set file root.

i'm not sure, files class can read , write attributes in files. may there specifict attribute operational system must set.

there setowner method if want manipulate too.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -