File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Error" Watch "Error" New topic


Prakash Chauhan

Joined: Aug 15, 2006
Posts: 8

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

Thanks in advance

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

Output completed (4 sec consumed) - Normal Termination
Peter Chase
Ranch Hand

Joined: Oct 30, 2001
Posts: 1970
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 ]

Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.
Prakash Chauhan

Joined: Aug 15, 2006
Posts: 8
I got the deprecated method with respect to line no. Thanks a lot.
I agree. Here's the link:
subject: Error
It's not a secret anymore!