How can you code an openhab script with Normal Java

Then you are not writing Rules. Or if you are writing Rules, you are not following the documentation for how to write Rules.

See

Reviewing How to get started (there is no step-by-step tutorial) would be a good idea as there are lots of good resources there.

Some important quotes from the Rules docs:

The openHAB VS Code Extension offers support for rules building. It includes syntax checks and coloring, validation with error markers, content assist (Ctrl+Space) incl. templates etc. This makes the creation of rules very easy!

The rule syntax is based on Xbase and as a result it is sharing many details with Xtend, which is built on top of Xbase as well. As a result, we will often point to the Xtend documentation for details.

Based on Xbase and sharing commonality with Xtext does not mean is eaxactly Xtext. The language is a Domain Specific Language unique to openHAB. The only IDE support is VSCode with the openHAB Extension. Not Eclipse.

Rules DSL is not the only option. Search the forum and the docs for “Python”, “Jython”, “JavaScript”, “Scripted Automation”, or “JSR223” and you will find tons of resources.