I was trying to use joptsimple package in my project but I get following error:
Error:(4, 20) java: package jdk.internal.joptsimple is not visible
(package jdk
You are apparently using an internal API, which you shouldn't. Such APIs are not standardized - they can differ from JVM to JVM and may change at any time without notice.
That said, if you still want to use it, you can do so by adding the following command line flag at compile and run time (i.e. to javac
and java
):
--add-exports jdk.internal.opt/jdk.internal.joptsimple=ALL-UNNAMED
If you are creating a module you can replace ALL-UNNAMED
by your module name.