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?

Recommended Answers

All 3 Replies

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:

http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Deprecated.html

and here :

http://www.j2ee.me/j2se/1.5.0/docs/tooldocs/windows/javac.html

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.