.jar file cannot find folders in the same directory as the .jar file
Hi There,
I am using NetBeans 7.0 to do my honours project to solve the Traveling Salesman Problem, and came across a problem i'm having.
I built my project and now have a .jar file which i can run from command line, but the project uses two folders where my datasets are found. If my .jar file and folders are all in my home folder i have no problem, but when i take them and put them in another folder, the .jar file complains and says that it cant find the folders (apparently its looking for the folders in my home directory).
How do i configure my jar file to find the folders in the same directory the jar file is located and not my home directory?
The code i'm using to locate the folders are as follows:
File file = new File("optimal_datasets");
String[] datasets = file.list();
for(String data : datasets){
jComboBox.addItem(data);
}
Thanks
Ronald Mariah
Re: .jar file cannot find folders in the same directory as the .jar file
To see where the program is looking for the File: file, print out its absolutePath.