1

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?

skaffman
  • 398,947
  • 96
  • 818
  • 769
Maverick
  • 11
  • 1

1 Answers1

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().

Wizard of Kneup
  • 1,863
  • 1
  • 18
  • 35
  • Hi I am running like this, javac -cp d:\eclipse\plugins\* org.command.test\src\CommandTest.Java Once the class file is created. java -cp d:\eclipse\plugins\* org.command.test.CommandTest Then am getting Workspace is closed. I didnt found option switch -data. Could you please let me know how to run. May be am going in wrong direction. Thanks in advance – Maverick Jul 19 '10 at 06:24
  • If I understand you correctly than you run a test on the compiled code. At runtime you will need a workspace. The -data is a command switch for Eclipse. You need to run Eclipse to test your code. Try to test from Eclipse and use the Run As -> JUnit Plug-in Test in the popup menu in the Package Explorer. – Wizard of Kneup Aug 10 '10 at 07:53