The ruby version of cucumber supports a global before hook. An *.rb file placed in the features/support directory gets apparently called only once, before any and all scenarios run. See https://github.com/cucumber/cucumber/wiki/Hooks#global-hooks
That seems to be a great way to make sure a database (used in read-only during tests) gets populated (and thus is in a known state) before any tests run.
Is there a similar feature available for the Java version of cucumber?
As far as I know global hooks are not supported by Cucumber-JVM. However, you could try (tagged) hooks, @Before annotations and as a work-around static fields. Have a look here for an example.
Please follow this link. this a workaround for @BeforeAll and @AfterAll
https://github.com/cucumber/cucumber-jvm/issues/515