Any ideas how to fix it?Access restriction: The method setOpacity(Window, float) from the type AWTAccessor.WindowAccessor is not accessible due to restriction on required library C:\Program Files\Java\jre6\lib\rt.jar
Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
Any ideas how to fix it?Access restriction: The method setOpacity(Window, float) from the type AWTAccessor.WindowAccessor is not accessible due to restriction on required library C:\Program Files\Java\jre6\lib\rt.jar
When dealing with this, you can only access these methods using Reflection, which as you might know is bad
Reflection
It should also be noted that some of the things you are trying to do are said to be avaliable in Java 7 when it is released and you will not need to use the Reflection API. I would recommend holding off until then if I was you I cannot say for certain that this is true so don't hold my word for it
Chris
I already downloaded jdk 7. Why isn't it now recognizing it?
You're best just googling the topic, there are lots of debates on it. Have a read for yourself rather than me regurgitating it lol!
Reflection is "bad" because it's very unclear what's happening. Also, it pushes most checks made at compile-time to checks which are made at runtime, making reflective code very difficult to debug.
Well, I did something very stupid to try and fix the problem. I had no clue how to change the jdk version itself in the library, so I just imported all of jdk 7.0 into my project!
Well, now it takes forever and a lot of days to load up! I put the new jdk in the src of either a project or a package. It keeps trying to build workspace for that project, even when I told it to stop several times. My computer keeps locking up. And also the new jdk still runs into those restrictions. It asked for a way to figure out how to reshape a Window into the shape of an alarm clock, or any shape other than the typical rectangle. I went to a site copeg recommended. However, I hoped that by importing the jdk, it would change the setting in the library. Stupid, yes, I know. I suppose I could just manually either copy the files into a new project and package and then delete the old project and package, or I could, it would take even longer than the first option, delete all the .java and .class files from the new jdk. I could just delete all 5 packages and hope those are all the new ones. It wouldn't be good to delete stuff I need to import from the regular jdk.
Also, I'm still baffled as to why certain files, especially as they get bigger, seem to save the code I had and only compile at that point, regardless of how much code, good or bad, I put in. I would like to know if you guys have any idea what could be causing that.
I'll show you what I mean by the problem in the paragraph above:
ORIGINAL CODE
String str = JOptionPane.showInputDialog("Enter a word", "Enter something", JOptionPane.PLAIN_MESSAGE);
UPDATED CODE (BAD)
String str = JOptionPane.showInputDialog("Enter a word", "Enter something", JOptionPane.PLAIN_MESSAGE); javapenguin loves penguins!
UPDATED CODE(GOOD)
String str = JOptionPane.showInputDialog("Enter a word", "Enter something", JOptionPane.PLAIN_MESSAGE); System.out.println(str);
What the second 2 will do is only do what the original does.
The second one, the bad one, will highlight the error, but won't throw an error message in the console and will just show the JOptionPane.
The third one, the good one, will show the JOptionPane, but not print out str.
Is it perhaps some glitch that occurs after a while in Run Configurations? Does it not compile anymore after a certain file size?