Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does a "restricted library" really mean in Java?

I'm working on some imaging applications from a book my professor gave me. The book's from 2001 and Eclipse is telling me on some of the lines things like "Access Restriction: the type JPEGImageEncoder is not accessible due to restriction on a required library /usr/lib/jvm/java-6-openjdk/jre/lib/rt.jar".

I know I can suppress these warning, but will that cause other problems?

like image 905
danmcardle Avatar asked Apr 09 '26 06:04

danmcardle


2 Answers

These warnings are a feature of Eclipse, and are not generally pertinent to Java.

The warnings are there because the API you are using is not guaranteed to be supported by all Java implementations (like Harmony, or IBM), or even to be present in a future version of the Oracle implementation.

Relying on these APIs risks a NoSuchMethodError or ClassDefNotFoundError at runtime.

like image 159
erickson Avatar answered Apr 11 '26 18:04

erickson


I think this is more related to eclipse than to Java itself.

See if the content in this article helps you.

from the article

It says you can just change the level of the message so you can continue. It may be what you need. Give it a try and let us know.

like image 36
OscarRyz Avatar answered Apr 11 '26 19:04

OscarRyz



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!