java - Eclipse can find file but Exe file cannot despite the fact that the file is in the same directory, -


for text maze game, eclipse can find text file , run properly, when convert jar of project exe, exe cannot find file. strange thing both jar file created , exe in same directory, yet jar file runs whereas exe file not. why this?

here code:

try {     //find file, create maze, etc. } // exceptions catch (filenotfoundexception e) {     file file = new file("maze.txt");      system.out.println(file.canread());     system.out.println(file.getabsolutefile().exists()); } 

both of 2 prints output false when run exe, though of files in same directory , works jar file. why this? using iexpress convert exe way.

you can use launch4j easy use

launch4j cross-platform tool wrapping java applications distributed jars in lightweight windows native executables. executable can configured search jre version or use bundled one, , it's possible set runtime options, initial/max heap size. wrapper provides better user experience through application icon, native pre-jre splash screen, , java download page in case appropriate jre cannot found.


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -