There's no shortage of Java hosting companies that you can sign up with: https://coderanch.com/how-to/java/ServletsFaq#hosting, but for regulations governing your part of the world you'll have to get competent advice from someone who knows their way around your jurisdiction.
Well what is considered as "illegal" is subjective based on the rules set forth by the government in question.
Like some governments may not allow your website that says bad about the government itself.
Although you may not require permission to open such a site but you may face a shutdown later.
Amit Ghorpade wrote:
Like some governments may not allow your website that says bad about the government itself.
Although you may not require permission to open such a site but you may face a shutdown later.
With such governments getting shut down may be the least of your worries!