Hi Erando, Well, let's start from the middle:
> [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] If you registered your command the above way, you have to obtain it by calling command = cm.getCommand("myCatalog", "myCommand") or command = cm.getCommand("myCatalog-myCommand") i.e. specify the catalog. > 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: > ... > 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? > Bingo! http://docs.oracle.com/javaee/5/tutorial/doc/bnadx.html Regards, J.Ch. -- Jozef Chocholacek Senior Developer Magnolia International Ltd. --------------------------------------------- Magnolia® - Yes, we're open. --------------------------------------------- ---------------------------------------------------------------- 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]> ----------------------------------------------------------------
