Workspace is closed error

大憨熊 提交于 2019-12-11 07:44:02

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!