views:

53

answers:

2

Hi,

I am newbie for eclipse. 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?

Thanks in advance,

A: 

Hi,

Thanks for your reply.

I have tried with getResource also. Still am getting the Workspace is closed error.

========Code Snippet==================:

XMLResource resource = (XMLResource)resourceSet.getResource(URI.createFileURI("C:/temp/foo.arxml"), true);

====================================================

In this above line am getting "IllegalStateException: Workspace is closed".

I have created a plugin project in eclipse and running in eclipse environment, its working fine.

If am trying to run in commandLine (Dos prompt). I am getting the IllegalStateException. I want to run the plugin project through commandline.

Is there any workaround is available? Anyone please guide me to solve this issue.

Thanks in Advance.

Maverick
A: 

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
HiI am running like this, javac -cp d:\eclipse\plugins\* org.command.test\src\CommandTest.JavaOnce the class file is created.java -cp d:\eclipse\plugins\* org.command.test.CommandTestThen 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
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