JavaIoFileSystemAccess - null pointer [message #1014000] |
Sun, 24 February 2013 18:53  |
Eclipse User |
|
|
|
Hi,
the following
public static void main(String[] args) {
JavaIoFileSystemAccess fileWriter = new JavaIoFileSystemAccess();
fileWriter.setOutputPath("out");
fileWriter.generateFile("bla", "content");
return;
}
raises a NullPointerException.
After looking into the code, I see the problem is that two members of the class JavaIoFileSystemAccess are never initialized. The constructor with no args does nothing. There are no setters.
My project depends on the jar org.eclipse.xtext_2.2.1... .jar , which is stored on my filesystem.
However my Eclipse (Juno) has version 2.3.1 of xtext
When I ctrl+click on JavaIoFileSystemAccess in my code it opens the class file, saying that there is no source attached. But when I click in the console on the error message of the exception, it magically opens a source file, which I think is the one installed in eclipse.
How am I supposed to use JavaIoFileSystemAccess?
Do you think I am having a version conflict problem?
Thanks in advance
B.
|
|
|
|
|
|
|
Re: JavaIoFileSystemAccess - null pointer [message #1053367 is a reply to message #1053366] |
Sat, 04 May 2013 12:26   |
Eclipse User |
|
|
|
Thanks for the reply
No, I am NOT using guice.
I don't want to do it, it is not necessary with org.eclipse.xtext_2.2.1... .jar (I never used guice for JavaIoFileSystemAccess before, and it always worked)
As I said, a trivial code such as this
public static void main(String[] args) {
JavaIoFileSystemAccess fileWriter = new JavaIoFileSystemAccess();
fileWriter.setOutputPath("out");
fileWriter.generateFile("bla", "content");
return;
}
reproduces the problem, i.e. raises the null pointer exception
The classpath of my project is very simple, it includes some external jars, including org.eclipse.xtext_2.2.1... .jar
The project (let me call it 'P') is a regular java project, where i want to use the code generator of a DSL of mine; therefore the project depends on some xtext jars. It also has a dependency on my DSL project (a "project reference" in Eclipse)
I have the feeling that Eclipse is "linking" my project with org.eclipse.xtext_2.3.1... .jar even though the classpath is configured with the version 2.2.1 of the jar
Maybe the problem is that the DSL project is actually using the 2.3.1 jars (this is the default "plugin dependencies", in the project properties), so maybe it overrides the classpath of 'P'.
Hope this gives you a little bit more of context info
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04748 seconds