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.

Results 1 to 8 of 8

Thread: Strange error message

  1. #1
    Banned
    Join Date
    May 2010
    Location
    North Central Illinois
    Posts
    1,631
    My Mood
    Sleepy
    Thanks
    390
    Thanked 112 Times in 110 Posts

    Unhappy Strange error message

    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
    Any ideas how to fix it?


  2. #2

  3. #3
    Senile Half-Wit Freaky Chris's Avatar
    Join Date
    Mar 2009
    Posts
    834
    My Mood
    Cynical
    Thanks
    7
    Thanked 105 Times in 90 Posts

    Default Re: Strange error message

    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

  4. #4
    Banned
    Join Date
    May 2010
    Location
    North Central Illinois
    Posts
    1,631
    My Mood
    Sleepy
    Thanks
    390
    Thanked 112 Times in 110 Posts

    Default Re: Strange error message

    I already downloaded jdk 7. Why isn't it now recognizing it?

  5. #5
    Banned
    Join Date
    May 2010
    Location
    North Central Illinois
    Posts
    1,631
    My Mood
    Sleepy
    Thanks
    390
    Thanked 112 Times in 110 Posts

    Question Re: Strange error message

    Quote Originally Posted by Freaky Chris View Post
    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
    Why is reflection bad? How can I use it? Is it hard to use?

  6. #6
    Senile Half-Wit Freaky Chris's Avatar
    Join Date
    Mar 2009
    Posts
    834
    My Mood
    Cynical
    Thanks
    7
    Thanked 105 Times in 90 Posts

    Default Re: Strange error message

    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!

  7. #7
    Super Moderator helloworld922's Avatar
    Join Date
    Jun 2009
    Posts
    2,896
    Thanks
    23
    Thanked 619 Times in 561 Posts
    Blog Entries
    18

    Default Re: Strange error message

    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.

  8. #8
    Banned
    Join Date
    May 2010
    Location
    North Central Illinois
    Posts
    1,631
    My Mood
    Sleepy
    Thanks
    390
    Thanked 112 Times in 110 Posts

    Red face Re: Strange error message

    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?

Similar Threads

  1. How to make an error message when my program crashes?
    By noFear in forum Java Theory & Questions
    Replies: 10
    Last Post: August 11th, 2010, 08:50 AM
  2. an error message while runnung java
    By sravan_kumar343 in forum Java Theory & Questions
    Replies: 1
    Last Post: January 25th, 2010, 10:19 AM
  3. help with a error message
    By JavaNoob82 in forum What's Wrong With My Code?
    Replies: 6
    Last Post: January 23rd, 2010, 02:56 PM
  4. Strange Compiling Error
    By crism85 in forum What's Wrong With My Code?
    Replies: 5
    Last Post: October 13th, 2009, 12:59 AM
  5. SOAP Message Factory response error
    By Buglish in forum File I/O & Other I/O Streams
    Replies: 3
    Last Post: November 6th, 2008, 01:42 PM