WB uses wrong Classpath [message #1101542] |
Wed, 04 September 2013 11:43  |
Eclipse User |
|
|
|
Hi!
I'm facing the problem that a FileNotFoundException is thrown in my MainFrame, when I open the design page. I've written small test classes, which isolate the problem and I will explain my issue based on my example.
My Test-MainFrame looks like this:
package test;
import javax.swing.JFrame;
public class Testframe extends JFrame {
/** */
private static final long serialVersionUID = -7304518081501850501L;
public Testframe() {
this.getRootPane().add(new Testpanel());
}
}
In my application an embedded panel loads some combo box values from a file. If an error occurs it shows a message to the user, that the file could not be loaded.
In my example the embedded panel just opens a file:
package test;
import java.io.File;
public class Testpanel extends JPanel {
/** */
private static final long serialVersionUID = -8125209595694433094L;
public Testpanel() {
try {
new FileInputStream(new File("settings/test.txt"));
} catch (FileNotFoundException e) {
JOptionPane.showMessageDialog(this, "Error Reading test.txt!" + e, "File Error", JOptionPane.ERROR_MESSAGE);
}
}
}
The settings folder is within my Testproject. (Testproject/settings/test.txt)
If I run the frame with Java I get no error:
package test;
public class Main {
public static void main(String[] args) {
new Testframe().setVisible(true);
}
}
If I open the design page of Testframe I get the error message popup. The problem seems to be the classpath. WB searches the file in my eclipse directory.
From what I've read in the forum, WB should use the project classpath.
For clarification: This issue is just nasty for me and I will try the $hide$ annotations, but I thought you're interested in it and want to fix it ; )
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.28859 seconds