Like AnatolyG suggested, it works specifying the full path for the log! (I wonder why.. but it works, and that's enough!)
So, this is an example to make work the code above:
public static void main(String[] args) throws FileNotFoundException, IOException, URISyntaxException {
CodeSource codeSource = TestJar.class.getProtectionDomain().getCodeSource();
File jarFile = new File(codeSource.getLocation().toURI().getPath());
String jarDir = jarFile.getParentFile().getPath();
FileOutputStream fout = new FileOutputStream(jarDir+"/JarTest.log", true);
fout.write(jarDir.getBytes());
}
Thanks AnatolyG!