Hi guys,
I need your help here. Can you tell me how to run a single command which is not
part of a module?
I created a Java class TestCommand.java:
[code]public class TestCommand extends MgnlCommand {
public execute(Context ctx) {
System.out.println("TEST COMMAND");
}
}[/code]
I copied this file into WEB-INF/classes and registered it like this:
[img]http://i12.photobucket.com/albums/a235/mhbgif/command.jpg[/img]
Then I wanted to run it in the Groovy console:
[code]Welcome to the Magnolia Groovy Interactive Console! Type 'help' for more
info and a list of available commands. [Using Groovy version 1.7.10].
mgnl> cm = info.magnolia.commands.CommandsManager.getInstance()
===>
info.magnolia.commands.CommandsManager@1f701045
mgnl> command = cm.getCommand('myCommand')
===>
null
mgnl> command.execute(ctx)
NullPointerException: Cannot invoke method execute() on null object[/code]
But after the second line it doesn't return an object but null. I guess this is
because the java class hasn't been compiled yet. Is that true? How do I do this?
--
Context is everything:
http://forum.magnolia-cms.com/forum/thread.html?threadId=487971f2-483f-4373-a929-b5f1f50edc05
----------------------------------------------------------------
For list details, see http://www.magnolia-cms.com/community/mailing-lists.html
Alternatively, use our forums: http://forum.magnolia-cms.com/
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------