Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Error

 
Prakash Chauhan
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am getting following error at compile time. What does it shows & how to remove this error.

Thanks in advance
PC


---------- NewProgramcompile ----------
Note: TCP_Finger_Client.java uses or overrides a deprecated API.
Note: Recompile with -Xlint eprecation for details.

Output completed (4 sec consumed) - Normal Termination
 
Peter Chase
Ranch Hand
Posts: 1970
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's not actually an error. As far as I can see, your program has compiled successfully. But there is a warning.

The warning is saying that you have used one or more classes or methods from the Java API that are marked as deprecated. That means that problems have been identified with them and Sun recommend they no longer be used.

If you can adjust the command line used to compile your code, do what the message suggests and add the -Xlint option. This will tell you more about what deprecated method(s) you are using.

If you can't do that, you'll have to go through your code and look up all the Java API methods you are using in the documentation, to see which one(s) are deprecated.

Some deprecations are "stronger" than others. For instance, Thread.stop() is extremely seriously broken and must never be used, as your program will probably deadlock. In comparison, some of the deprecations in javax.swing might make your GUI look a bit odd, but won't make your code die.

Usually, the API documentation suggests what to use instead of the deprecated method. If you find you really have to use a deprecated method, I believe there is a compiler option to suppress the complaining messages; this is a last resort, though.
[ August 16, 2006: Message edited by: Peter Chase ]
 
Prakash Chauhan
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got the deprecated method with respect to line no. Thanks a lot.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic