1
votes

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.

2
What usually works for me if something like this happens is to remove the JRE System Library from the project and then re-add it. - awksp
Please add this as an answer so I can accept it. - aborted

2 Answers

2
votes

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.

1
votes

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.