Teach yourself Java in 21 days

N

Nick

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.
 
R

Ross Bamford

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.
 
C

Chris Uppal

Nick said:
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
 
R

Roedy Green

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.
 
N

Nick

Thank you all for the prompt advice. It's working so on to day 7. Not
as fast as I'd like of course.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top