Results 1 to 9 of 9
  1. #1
    Leprechaun is offline Member
    Join Date
    Dec 2007
    Posts
    30
    Rep Power
    0

    Default [SOLVED] An annoying warning everytime I compile

    Everytime I compile a file I get this warning:
    Note: C:\Documents and Settings\<user name>\Desktop\Multiple Desktops\DesktopArray.java uses unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details.

    Process completed.
    The file performs some basic file creation and movement in a folder in the C drive. If the code is needed I could provide it. I was wondering if there is a way I could stop this message from displaying every time I compile. I use JCreator if that matters at all...

  2. #2
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default

    Seems this warning related to your application. Did you get this warning for simple applications, just like printing a message?

  3. #3
    maxim is offline Member
    Join Date
    Apr 2008
    Posts
    15
    Rep Power
    0

    Default

    ive had this. basicly if you have any sort of Collection. like a ArrayList, HashSet ect you have to tell the compiler what Type of variables are going to be in it. for example

    ArrayList list = new ArrayList(); will give u that warning

    ArrayList<String> list = new ArrayList<String>(); will get rid of the warning because you told the compiler that your going to put strings in it. just change it to Integers or Objects or whatever your going to put in it.

  4. #4
    Leprechaun is offline Member
    Join Date
    Dec 2007
    Posts
    30
    Rep Power
    0

    Default Solved

    Thanks, that solved it. I was doing exactly what you said.

  5. #5
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default

    Interesting, Netbeans or Eclipse doesn't give this warning at all. Typically ArrayList can hold any primitive data type, no need to specified. What Java version you guys use?

  6. #6
    Leprechaun is offline Member
    Join Date
    Dec 2007
    Posts
    30
    Rep Power
    0

    Default

    I've got 1.6.0_01

  7. #7
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default

    I used 1.6.0_05 with Netbeans. So there is a bit different(actually improvement) in exceptions. Because I don't get such warnings in my applications.

  8. #8
    rico16135 is offline Member
    Join Date
    Apr 2008
    Posts
    28
    Rep Power
    0

    Default

    netbeans 6.0.1 gives me that message

  9. #9
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

Similar Threads

  1. WARNING NetBeans HTTP Monitor
    By bbq in forum JavaServer Pages (JSP) and JSTL
    Replies: 3
    Last Post: 09-19-2008, 06:02 PM
  2. doesn't compile?!
    By jon80 in forum New To Java
    Replies: 8
    Last Post: 06-14-2008, 05:42 PM
  3. Unable to compile
    By gapper in forum New To Java
    Replies: 2
    Last Post: 01-14-2008, 04:31 PM
  4. Not able to compile
    By bugger in forum New To Java
    Replies: 2
    Last Post: 01-09-2008, 10:13 PM
  5. warning: page has expired
    By Peter in forum Web Frameworks
    Replies: 2
    Last Post: 07-04-2007, 07:45 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •