0

I want to create directory in ubuntu at location /opt/ and the code is

File file=new File("/opt/myFolder"); file.mkdir();

executed successfully but directory is not created because the location is read only.Is there any way to give the write permission to ubuntu directory using java program.

Akram Ali
  • 11
  • 5
  • 2
    Of course, if you're not either root or the owner of the directory, you won't be able to change permissions, as it would be a severe vulnerability. – Eusebius Oct 03 '15 at 07:11
  • 2
    You need to launch your jar file as root. 'sudo java -jar yourJar.jar' – tirz Oct 03 '15 at 08:40

0 Answers0