M
Michael
Hi,
I have JARred up my Java app program so that it can be run by
double-clicking it. The problem now is that I can't run the Java app
as it can't find the PROPERTIES file in the JAR.
In my project, I included the folder "properties" where I store all
the properties files and I checked the folder exists in the JAR, but
somehow it is not able to locate it.
In my source file that tries to load the properties is shown below:
private final String DEFAULT_PROPERTY_FOLDER = "properties/";
private final String DEFAULT_NODE_PROPERTY_FILE =
"defaultNode.properties";
filePath = filePath = DEFAULT_PROPERTY_FOLDER +
DEFAULT_NODE_PROPERTY_FILE;
try {
inNode = new FileInputStream(filePath);
} catch (FileNotFoundException ex) {
System.out.println("[ " + propertiesFile + " ]" + " not
found.");
}
try {
load(inNode);
} catch (IOException ex1) {
System.out.println("Error loading up the default
properties file.");
}
I have JARred up my Java app program so that it can be run by
double-clicking it. The problem now is that I can't run the Java app
as it can't find the PROPERTIES file in the JAR.
In my project, I included the folder "properties" where I store all
the properties files and I checked the folder exists in the JAR, but
somehow it is not able to locate it.
In my source file that tries to load the properties is shown below:
private final String DEFAULT_PROPERTY_FOLDER = "properties/";
private final String DEFAULT_NODE_PROPERTY_FILE =
"defaultNode.properties";
filePath = filePath = DEFAULT_PROPERTY_FOLDER +
DEFAULT_NODE_PROPERTY_FILE;
try {
inNode = new FileInputStream(filePath);
} catch (FileNotFoundException ex) {
System.out.println("[ " + propertiesFile + " ]" + " not
found.");
}
try {
load(inNode);
} catch (IOException ex1) {
System.out.println("Error loading up the default
properties file.");
}