Java GPIO access problem

Hello. Please tell me, when you use the code get the error. What could be the reason? The file exists:/sys/class/gpio/gpio60/value

`

public static boolean value(int pin, int val){
OutputStream os = null;
try {
os = new FileOutputStream("/sys/class/gpio/gpio"+pin+"/value");
String s = “”+val;
os.write(s.getBytes(), 0, s.length()); //line 107
os.flush();
return new File("/sys/class/gpio/gpio"+pin+"/value").exists();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}finally {
if(os!=null)
try {
os.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return false;
}

`

Exception:
`

java.io.IOException: Operation not permitted
at java.io.FileOutputStream.writeBytes(Native Method)
at java.io.FileOutputStream.write(FileOutputStream.java:345)
at serial.GPIO.value(GPIO.java:107)

`

On Sat, 19 Mar 2016 00:55:26 -0700 (PDT),
gusevbess@gmail.com declaimed the following:

Hello. Please tell me, when you use the code get the error. What could be
the reason? The file exists:/sys/class/gpio/gpio60/value

public static boolean value(int pin, int val){
OutputStream os = null;
try {
  os = new FileOutputStream("/sys/class/gpio/gpio"+pin+"/value");

  My first thought would be to confirm that the string you generate here
IS what you expect (I don't know Java to know if appending an integer to a
string converts it to string form, and if it does, does it have
leading/trailing spaces -- I've worked with languages where positive
integers always convert with a leading space, which would hold a - sign for
negatives)

Exception:
java.io.IOException: Operation not permitted

  Second -- are you running from root? As I recall, pretty much all of
the I/O based pseudo-files are only writable from the root account.