I made a very simple runnable jar with the following code:
package stuff;
import java.io.File;
import javax.swing.JOptionPane;
public class Testing
{
public static void main(String[] args)
{
File file = new File("");
JOptionPane.showMessageDialog(null, file.getAbsoluteFile());
}
}
Placing this jar in example C:/Test/Hello and running it will cause the program to print C:/Test/Hello, which is absolutely correct.
Doing the same, but in Linux, and the program will print /home/pj1 no matter where the jar is located. This is wrong! It should print the path to its location.
Is there a way to fix this?