Q:

How to make echo 1 > /sys/class/gpio/gpio18/value in Java

I have a board that is not raspberry pi (it is olinuxino) with debian 7.  I found two libs for working with GPIO in java (Pi4j and DIO), but they can be used only on raspberry.  I need only to send one byte to certain linux file.  I tried:
File file=new File("/sys/class/gpio/gpio18/value");
FileOutputStream fos=new FileOutputStream(file);
byte[] bytes={1};
fos.write(bytes);//here exception

but I get java.io. IOException: Invalid argument. 
How to do it?  Is it possible? 
P.S. full exception :
java.io. IOException: Invalid argument. 
    at java.io. FileOutputStream.writeBytes(Native Method)
    at java.io. FileOutputStream.write(FileOutputStream.java:305)
    at MyClass.main(MyClass.java:9)

A:

Try this.  This is working.  You need to write character value 1 into the file.  Provide the value in single quotes.  Other wise it will write the ASCII value 1 which is start of heading. 
byte bytes='1';
fos.write(bytes);//here exception
fos.close();

Note : Always close the streams once your job is done.