tags:

views:

78

answers:

3

I've written some small programs that help me out parsing/analysing data.

I want to use those programs in my grails app.

Regarding my research so far, it is possible, but I don't see where I have to place my Java Code to get it running. Are there any examples available?

+1  A: 

If you are developing with Eclipse and the Groovy Plugin, the IDE will take care of compiling everything.

Since you can use any Groovy class in Java (and vice versa) natively (circular references have some caveats though) you just need to import your Java class into your groovy class (Grails controller / service) and use it as usual.

Daff
+1 possible solution. But i want to seperate Jave Code from my groovy Classes.
bastianneu
Oh ok I couldn't see that clear in your question. I like the way for just putting them in src/java/. I just think that one of the coolest things on Groovy is that you don't need to really separate because it works so great together.
Daff
+5  A: 

In Grails, put your Java source code under src/java/ in the Grails directory layout. This way, your Java code is compiled automatically when running grails run-app, grails war etc. To use your Java classes in Grails artefacts (eg. service), just import and use them.

Daniel Rinser
+1 Thank you for that hint. I found my way now by creating and using my own beans.
bastianneu
A: 

My colleague found an nice way to solve this:

Grails Doc

Works perfect for me...Problem solved :-)

bastianneu