I am so confused on this .... I have a Java application that I have written and want to run it in grails.
I found this article (How to run java programs in grails?) and I am confused about the solution that was approved.
I just need some clarity.
Thanks!
UPDATE:
Okay -- I made my project and then put in a contraller and put my java files in src/jave. I have one controller file and this is what it is (and this is the code in my controller):
//package mttestbox
import mttestbox.MTBoxController
//import MTInit
class MTBoxController {
def index()
{
MTInit.main(RunMT_GUI)
}
}
I am getting the following error (and it is not a surprise because I am so confused):
URI:/MTTestBox/MTBox/index
Class: groovy.lang.MissingPropertyException
Message: No such property: MTInit for class: mttestbox.MTBoxController
What did I do wrong???
Thanks!!
I found the answer. I found out that you have to put the groovy controller package declaration in the java class files(s).
package <groovy controller name>;
once that is done, the import can then be used in the controller. Once i did this, i was able to fire up grails and goto the default page and then, my app ran on my machine as an executable from a web call in grails (i did a /WEB-INF/grails-app/views/XXX/index.gsp not found error, but I think that because I have not made any GSPs yet (???).
Here is neat trick (found this using NetBeans): if you have more than one Java class file: 1. edit one of them by adding the groovy controller package name. 2. Save jave file. 3. Highlight all java class files needed (including the one that was edited in step 1). 4. move them to Java Source Packages folder in grails project. 5. when promted tell the IDE to move them. 6. When promted tell the IDE to Refactor.
Makes all the edits in all the needed files for you. Then - run and see what happens!!!
Thanks everyone!!!
ironmantis7x