java.lang.IllegalStateException: Workspace is closed. [message #143068] |
Tue, 14 March 2006 15:29 |
Eclipse User |
|
|
|
Background
---------- I have a java project in which I'm developing a package, that
ends up in .jar file used by several other projects. The package uses
JAXB, and for the Junit test cases, I have included in the project an
..xml document that gets marshalled and unmarshalled, plus the XMLSchema
to which the doc conforms.
Problem
------- In my test cases, I can not get at the document using the
ResourcePlugin, because the statment
IWorkspace ws = ResourcesPlugin.getWorskspace();
throws:
java.lang.IllegalStateException: Workspace is closed.
Google Result
------------- I found this from Alex Blewitt at
http://dev.eclipse.org/newslists/news.eclipse.platform/msg50 146.html
'You can't open the workspace unless you're running inside Eclipse. That
does not include running a Java application with a main method.
If your code is being called from a method like Plugin.start() and it's
being called from Eclipse, this will work. If the line above this code
reads 'public static void main(String args[]) then it won't work.'
Questions
--------
1. I'm executing my test classes from their source files in the
navigator view, using the right button menu 'Run As.. > Ju 2 unit test'
.. Since Junit is a plugin (org.Junit(3.8.1)), why is the workspace
showing closed ?
2. My ugly workaround is to use POJ File and FileStream to reach into
the project with an absolute filepath, but is there a way I can use
project-relative paths to my test files from Junit test cases ?.
Bill.
|
|
|
Powered by
FUDForum. Page generated in 0.10371 seconds