First, Java isn’t script based. It is a compiled programming language so interactive programming really isn’t a thing for Java like you might be used to in languages like Python.
There is an IDE for openHAB rules and configurations called openHAB Designer. It is based on Eclipse and can be downloaded from openHAB’s main site. I strongly recommend using Designer if you plan on using the DSL.
Therefore trying to build something up external from openHAB with its own runtime that you later plan on converting to rules inside of openHAB will likely not work very well. As it exists right now your best bet is to develop inside of an openHAB. This means using Designer, setting up Items, Persistence, Rules and Scripts and testing them on a running openHAB. Building something standalone with a “main” function is not an option.
I do keep saying things like “right now” and “as it exists” because I know Kai is working on a new rules engine for OH 2 which is going to support a way to write rules that are more generic and sharable. But until that is done…
Personally, I would suggest you develop in Jython instead of trying to convert to the DSL. It will much better support your desire to build up your rules separately and create unit tests and such. Though spend the time to figure out HOW openHAB works and ties everything together (it is an event based environment that follows a more actor based programming approach as opposed to a more traditional structured programming or OO approach). I bring this up as it may guide your approach and will limit how you structure your code.
All that being said, I am firm in my opinion that the DSL is an excellent language for writing HA rules and logic and advocate its use. I believe it is well worth learning and using. But because it is closer to an event driven actor based language developers who come to it and try to write their rules in a structured or OO manner end up fighting against the language instead of progressing. And that is one reason I suggest you might be happier using Jython.