Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

An illegal reflective access operation has occurred

I'm trying to use Kotlin in Visual Studio Code. I've just finished choosing the environment path, but when I try to run the program I get this warning every time:

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.intellij.util.ReflectionUtil to method java.util.ResourceBundle.setParent(java.util.ResourceBundle)
WARNING: Please consider reporting this to the maintainers of com.intellij.util.ReflectionUtil
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

If I try to run

--illegal-access=deny

I get the following errors:

error: unresolved reference: illegal
--illegal-access=deny
  ^
error: variable expected
--illegal-access=deny
  ^
error: unresolved reference: access
--illegal-access=deny
          ^
error: unresolved reference: deny
--illegal-access=deny

I'm a bit of newbie, so how can I fix this problem? Thanks for every answer!

like image 579
Perjesisza597 Avatar asked Oct 27 '25 12:10

Perjesisza597


1 Answers

I know its annoying, but, it's not actually something you need to worry about. You can run your program with the flag and not worry to much about the warning. For more in depth details there are a number of resources such as https://www.logicbig.com/tutorials/core-java-tutorial/modules/illegal-access-operations.html that go into more detail. It's more about prodding library authors into action than anything else.

The flag needs to be passed to the java command executing your program

Ex java --illegal-access=deny --module-path <path> --module <module>/<main-class> [args...]

like image 64
Deadron Avatar answered Oct 29 '25 01:10

Deadron



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!