I have a program with the following code:
import java.io.File;
import javax.swing.JOptionPane;
public class Main {
    public static void main(String[] args) {
        File file = new File("config");
        JOptionPane.showMessageDialog(null, file.getAbsolutePath());
        System.out.println(file.getAbsolutePath());
    }
}
I export this as a Runnable Jar in eclipse. Then I copy the file to /home/username/Desktop/ on my Ubuntu 13.04 system and cd to that directory. When I run the command java -jar Main.jar, I get the following output:
/home/username/Desktop/config
Now I run chmod to make the Jar executable, and then I go and double click on the Jar. I get the following output from the dialog:
/home/username/config
Why am I getting different output? Moving the Jar to other directories result in similar results. Googling and searching SO shed no light on this issue.
 
     
    