3

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?

danmcardle
  • 2,079
  • 2
  • 17
  • 25
  • 1
    Perhaps this will help: http://stackoverflow.com/questions/860187/access-restriction-on-class-due-to-restriction-on-required-library-rt-jar – Justin Ethier Aug 09 '10 at 17:27
  • This comment helped me to get rid of the warnings, but I really don't know why: http://stackoverflow.com/questions/860187/access-restriction-on-class-due-to-restriction-on-required-library-rt-jar/2555768#2555768 – danmcardle Aug 09 '10 at 17:30
  • Get rid of the book from 2001, it is hopelessly out of date, Java has changed a lot in the past 9 years. A good place to start learning current Java: http://download.oracle.com/javase/tutorial/index.html – Jesper Aug 09 '10 at 20:13
  • @Jesper I can't do that because this is the book my professor wants to work with. It's not just a general Java book, it's about medical imaging. He still thinks it has some value, so I'm gonna keep working with it. – danmcardle Aug 09 '10 at 21:36
  • ok, I assumed it was a book about programming in Java. – Jesper Aug 10 '10 at 07:43

2 Answers2

8

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.

erickson
  • 265,237
  • 58
  • 395
  • 493
3

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.

Community
  • 1
  • 1
OscarRyz
  • 196,001
  • 113
  • 385
  • 569
  • Thanks very much, but I already found that article. I'm really looking for an explanation as to what a restricted library is. Despite my best efforts, I can't seem to find out why some libraries are restricted and some aren't. – danmcardle Aug 09 '10 at 17:39