I tried compiling my java program and it gave me the following error:

Note: DnldURL.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

What does this mean?

Hi B89Smith, you can add the -deprecation option to the java command, as per the message, and recompile:

javac DnldURL.java -deprecation

You are using a part of the API that is now obsolete. The messages from the compile with the "-deprecation" switch will give you the details, then you ought to refer to the appropriate class documentation for what part of the API you should use as a replacement. I hope this helps.

See here for more information:


and here :


A program element annotated @Deprecated is one that programmers are discouraged from using, typically because it is dangerous, or because a better alternative exists. Compilers warn when a deprecated program element is used or overridden in non-deprecated code.

commented: Helpful info +25

Also note that it's a compiler warning, not an error. You can still run the program just fine.

commented: Good point +5

Yes, sorry, I omitted to mention that actually, thanks Ezzaral.