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 4 of 4

Thread: How to have IDE give warning message

  1. #1
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    22,346
    Thanks
    56
    Thanked 2,376 Times in 2,346 Posts

    Default How to have IDE give warning message

    How do you configure the IDEs to give the warning message given by javac's -Xlint option?
    D:\Java\jdk1.6.0_29\bin\javac.exe -Xlint  TestCode12.java
     
    TestCode12.java:116: warning: [empty] empty statement after if
          if(true);
                  ^
    1 warning


  2. #2
    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: How to have IDE give warning message

    For which IDE?

    In Eclipse, if you go to Preferences > Java > Compiler > Errors/Warnings you can change the behavior for various compiler hints.

    I'm unfamiliar with what the -Xlint flag does and I can't find any documentation for it, but Eclipse has a setting for empty statements (under Potential Programming Problems).

  3. #3
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    22,346
    Thanks
    56
    Thanked 2,376 Times in 2,346 Posts

    Default Re: How to have IDE give warning message

    From the javac doc:
    Non-Standard Options

    -Xbootclasspath/p:path
    Prepend to the bootstrap class path.
    -Xbootclasspath/a:path
    Append to the bootstrap class path.
    -Xbootclasspath/:path
    Override location of bootstrap class files.
    -Xlint
    Enable all recommended warnings. In this release, all available warnings are recommended.
    I get code from OPs using Netbeans with this problem. What do they need to do to get a warning from their IDE?
    If you don't understand my answer, don't ignore it, ask a question.

  4. #4
    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: How to have IDE give warning message

    I'm not a Netbeans user so I don't know how much help I can be, but I did find this question over at StackOverflow which might be promising.

Similar Threads

  1. Warning when I do a build
    By mad_hatter in forum What's Wrong With My Code?
    Replies: 3
    Last Post: March 24th, 2012, 03:26 PM
  2. Warning! Greenhorn alert
    By Montrell79 in forum Member Introductions
    Replies: 2
    Last Post: March 6th, 2012, 03:56 AM
  3. suppress warning
    By mDennis10 in forum Java Theory & Questions
    Replies: 2
    Last Post: September 10th, 2011, 11:06 AM
  4. Unchecked or Unverified Warning
    By saxophonemaster in forum What's Wrong With My Code?
    Replies: 1
    Last Post: April 2nd, 2011, 09:59 PM