I hava a .java file that i want to edit using a java program. Basically I simply want to add an "implement something" after the "class name"
I tried using randomAccessFile that i found on stackoverflow but the problem with it was that it was overwriting the next bytes... How could i simply insert it instead of overwriting the next bytes?
RandomAccessFile f;
try {
f = new RandomAccessFile(new File("the path of my file"), "rw");
f.seek(line.length()-1); // goes to where i want to write
f.write(name.getBytes()); //writes the string in name
f.close();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}