Reputation: 749
I try to open file.txt with editor.exe
editor.exe is converted from editor.jar that is written on Java
Do I have the ability to get file.txt absolute file path from inside java source code of editor.exe?
Upvotes: 0
Views: 269
Reputation: 201447
Look at your main
method; specifically,
public static void main(String[] args) {
// args[0] should be the path that was requested, in which case you
// could use
if (args.length > 0) {
java.io.File f = new java.io.File(args[0]);
if (f != null && f.exists()) {
try {
System.out.println(f.getCanonicalPath());
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
Upvotes: 1