aborted
aborted

Reputation: 4541

Getting "Access restriction error" when using Swing utilities in Eclipse

I'm using Mac for the first time and I'm assuming this is a OS specific error, because the same code worked well on Ubuntu.

I'm trying to compile this code and Eclipse is showing me a lot of errors like this one:

Access restriction: The method invokeLater(Runnable) from the type SwingUtilities is not accessible due to restriction on required library /Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home/jre/lib/rt.jar

This is the first time I facing something like this and I don't know how to continue.

I'm using Java 8.

Upvotes: 1

Views: 1084

Answers (2)

awksp
awksp

Reputation: 11867

I honestly have no clue why this happens, and it's a pain when I can't remember how I fixed it last time. Some Eclipse quirk, I suppose.

I usually fix this by removing the JRE System Library from the build path and then adding it back.

Upvotes: 2

dARKpRINCE
dARKpRINCE

Reputation: 1568

I guess is that Mac does not support System Trays. You should check if support exists using the method java.awt.SystemTray.isSupported(). Does this return true?

EDIT: I guess the problem is more at the Eclipse IDE level? Try reinstalling Java.

Upvotes: 1

Related Questions