Gitlab CI Runner command line doesn't care about --parameters
You're missing the --non-interactive tag to your registration command.

Full command should be:

gitlab-runner register --non-interactive --locked false --run-untagged true --tag-list java --name foo --registration-token %token% --url https://myurl --executor shell


Relevant documentation for non-interactive registration.