In current implementation of RamdomAccessFile.java, it seeks to the end of a file to get the file size, which brings different problems to windows and *nix platforms.
When using FILE_FLAG_NO_BUFFERING to open a file, you cannot, in general, get the file size by doing a zero seek relative to FILE_END. The end of the file may not coincide with a sector boundary and trying to seek to a non-aligned position (even if you are just trying to find out what that position is) is illegal and will fail. The workaround is to use GetFileSizeEx instead.
It will throw IOException when checking /proc files. This is the same issue reported in jdk-7132461.
RandomAccessFile raf = new RandomAccessFile("/proc/cpuinfo", "r");
System.out.println("RF:" + raf.length());