Teach yourself Java in 21 days

Discussion in 'Java' started by Nick, Oct 22, 2005.

  1. Nick

    Nick Guest

    I'm up to day 6 and can't compile Storefront correctly to move forward.
    I receive the following error message:

    c:\j21work\org\cadenhead\ecommerce>javac -classpath "" *.java
    Note: Storefront.java uses unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details..

    Any help much appreciated.
     
    Nick, Oct 22, 2005
    #1
    1. Advertising

  2. Nick

    Ross Bamford Guest

    On Sat, 22 Oct 2005 14:15:14 +0100, Nick <>
    wrote:

    > I'm up to day 6 and can't compile Storefront correctly to move forward.
    > I receive the following error message:
    >
    > c:\j21work\org\cadenhead\ecommerce>javac -classpath "" *.java
    > Note: Storefront.java uses unchecked or unsafe operations.
    > Note: Recompile with -Xlint:unchecked for details..
    >
    > Any help much appreciated.
    >


    Don't worry too much about it - these are only warnings, and occur because
    some of the code does some slightly hairy stuff with typing. Reasons
    include:

    + It was written when no alternative means was available.

    + It deliberately avoids type safety for the sake of example.

    + The programmer made a (often valid) decision that he knew something the
    compiler didn't.

    If you add the -Xlint:unchecked argument to the javac command, you'll see
    a detailed list of the warnings. It's probably best to ignore them for
    now, though, and concentrate on the basic concepts from your book.

    --
    Ross Bamford -
     
    Ross Bamford, Oct 22, 2005
    #2
    1. Advertising

  3. Nick

    Chris Uppal Guest

    Nick wrote:

    > c:\j21work\org\cadenhead\ecommerce>javac -classpath "" *.java
    > Note: Storefront.java uses unchecked or unsafe operations.
    > Note: Recompile with -Xlint:unchecked for details..


    That's because Sun introduced some extensions into the most recent version of
    Java, and the compiler is trying to force you to use them. Leaving aside the
    question of whether the extensions are a good thing or not, they are a
    complication that you don't need at this stage, and especially not while you a
    trying to follow a book which pre-dates them.

    The easiest way of sorting the problem is just to ignore the messages ;-) but
    if you prefer you can tell the compiler that you are writing in "old" Java:

    javac - source 1.4 -classpath ....etc...

    -- chris
     
    Chris Uppal, Oct 22, 2005
    #3
  4. Nick

    Roedy Green Guest

    On 22 Oct 2005 06:15:14 -0700, "Nick" <>
    wrote or quoted :

    >Note: Recompile with -Xlint:unchecked for details..


    Chris's advice is practical. If you want to see the errors type

    javac -source 1.5 -target 1.5 -Xlint:unchecked *.java

    That will show you the warnings, which will have to do with missing
    generic declarations. If you feel up to tackling them, read
    http://mindprod.com/generics.html
    Otherwise, for now, just ignore the warning messages about "unchecked"
    stuff.
    --
    Canadian Mind Products, Roedy Green.
    http://mindprod.com Again taking new Java programming contracts.
     
    Roedy Green, Oct 23, 2005
    #4
  5. Nick

    Nick Guest

    Thank you all for the prompt advice. It's working so on to day 7. Not
    as fast as I'd like of course.
     
    Nick, Oct 24, 2005
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Bill Tomlin
    Replies:
    0
    Views:
    432
    Bill Tomlin
    Jan 31, 2004
  2. David Stockwell
    Replies:
    2
    Views:
    724
    Anna Martelli Ravenscroft
    Sep 20, 2004
  3. Gerrit
    Replies:
    0
    Views:
    406
    Gerrit
    Sep 20, 2004
  4. Jacob Oost

    Finished a "teach yourself" book, what next?

    Jacob Oost, Jan 30, 2005, in forum: C Programming
    Replies:
    33
    Views:
    980
    Mabden
    Feb 16, 2005
  5. Martin DeMello

    ANN: Teach yourself Ruby - the hard way!

    Martin DeMello, Feb 23, 2008, in forum: Ruby
    Replies:
    11
    Views:
    209
    Martin DeMello
    Feb 27, 2008
Loading...

Share This Page