Ho trovato questo...
codice:
String path =Test.class.getProtectionDomain().getCodeSource().getLocation().getPath();
String decodedPath =URLDecoder.decode(path,"UTF-8");
Ma genera un errore nell'ActionPerformed(evt) del JButton che crea il file e dovrebbe anche visualizzare il path.