问题
I have created a EMF model and generated a model code for that. I have created one plugin project and i have created one class named as 'CommandTest' which is having "public static void main()" method which reads mymodel resource file.
Its working fine in eclipse 3.5.2. There is no issues am able to read the contents.
But same thing am running through command prompt, am getting error "Workspace is closed". I have included my plugin folder in my classpath.
I have used one statement resource.load(null). In this line am getting "IllegalStateException: Workspace is closed".
I want to run my project in commandline not in eclipse environment. I have searched this problem in internet, i can able to find some solutions but its all related to eclipse environment.
If anything am doing wrong in this following statement
====Code Snippet======
file = "C:\temp\mytemp.xml";
// Creating resource
XMLResource resource = (XMLResource) new MyModelResourceFactoryImpl().createResource(
URI.createURI(file.toURI().toString(), true));
resource.load(null);
=======================
Is it possible to run plugin project in commandline? if it is possible could any one guide me how to achieve this to avoid "workspace is closed" error?
回答1:
Did you try to specify a workspace with the -data <workspace-path>
command line switch? You could try as well to call Plugin.getStateLocation()
.
来源:https://stackoverflow.com/questions/3200960/workspace-is-closed-error