I have created an app in which all labels are fetched from a file called text.properties, it is running fine in my IDE, but when i run the jar file using command prompt, the error below is raised.
Oct 04, 2013 9:28:14 AM Main.LoginFrame <init>
SEVERE: null
java.io.FileNotFoundException: text.properties (The system cannot find the file
specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(Unknown Source)
at java.io.FileInputStream.<init>(Unknown Source)
at GraphicUserInterface.LoginFrameGUI.initializingLoginElements(LoginFra
meGUI.java:30)
at Main.LoginFrame.<init>(LoginFrame.java:72)
at Main.Main.main(Main.java:41)
Exception in thread "main" java.lang.NullPointerException
at Main.LoginFrame.<init>(LoginFrame.java:81)
at Main.Main.main(Main.java:41)
The sample piece of code that calls this properties file is as given below
Properties prop=new Properties();
prop.load(new FileInputStream("text.properties"));
logFrame.usernamelbl = new JLabel(prop.getProperty("lusernamelbl"));
The same approach has worked for me in the past. I have copied the properties type into the netbeans project folder. Please help me to find a solution for this.