Build Warning!

Posted on 2011-10-17
Last Modified: 2012-06-21
How can I get this warning off my Build procedure

warning: [options] bootstrap class path not set in conjunction with -source 1.5
Note: C:\Documents and Settings\User\My Documents\NetBeansProjects\iDA\iDA\src\ida\resources\ uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Question by:snajalm
    LVL 47

    Expert Comment

    You probably need to use generics in the collections - arraylistor hashmap or something
    LVL 47

    Assisted Solution


    To oversimplify it, if you have multiple versions of Java say 5, 6 and 7 installed you want to be sure that you compile and run with the same version. This warning suggests to me a possible incompatibility exists compiling for an old JVM and running on a new one.

    The unchecked ones are a generics issue and the source level compatibility issues that arise. Older classes such as much of Swing did not use generics so you would have had a return class like JList whereas the newer compilers would want something like JList<String> so it can do type checking at compile time. As far as I can tell not all Swing components have been upgraded to use Generics although some have. So even compiling and running on Java 7 has situations where this warning comes up.

    LVL 47

    Accepted Solution


    To use javac from JDK N to cross-compiler to an older platform version, the correct practice is to:

        Use the older -source setting.
        Set the bootclasspath to compile against the rt.jar (or equivalent) for the older platform.

    If the second step is not taken, javac will dutifully use the old language rules combined with new libraries, which can result in class files that do not work on the older platform since references to non-existent methods can get included.

    Thanks to work by Jon Gibbons, in JDK 7 build 121 and later javac detects and warns about this suspicious situation; for example:

        $ javac -source 6
        warning: [options] bootstrap class path not set in conjunction with -source 1.6

    One way to address the warning is to set the bootclasspath. If that is inappropriate, the warning can be disabled with a new suboption within the -Xlint family, -Xlint:-options.

    With this change, a likely problematic combination of options to javac that can lead to subtle build errors are diagnosed by the compiler and can easily by either directly addressed, or documented as part of the build process via the new -Xlint suboption.
    LVL 47

    Assisted Solution

    recompile with -Xlint and you'll n=know what in particular is a problem; we can then try to address it _ most probable it is about generics

    Author Closing Comment

    Thanks heaps!

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    copyEndy  challenge 15 40
    firstChar challenge 13 57
    Starting to learn JAVA, 7 37
    Unable to start eclipse ? 17 50
    Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
    Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
    Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
    This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    24 Experts available now in Live!

    Get 1:1 Help Now