jQuery in Action, 3rd edition
The moose likes Beginning Java and the fly likes Deprecation compile option  ???? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Deprecation compile option  ????" Watch "Deprecation compile option  ????" New topic

Deprecation compile option ????

Shara Woods

Joined: Jul 06, 2004
Posts: 4
For a project i work on when i say make -f makefile I get the following error.

6 files use or override a deprecated API. Recompile with "-deprecation" for details.

Can somone please explain how to use this on command line?
Dirk Schreckmann

Joined: Dec 10, 2001
Posts: 7023
javac -deprecation Foo.java

[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Mahesh Bhatt
Ranch Hand

Joined: Sep 15, 2004
Posts: 88

in the newer versions of java some methods have been deprecated . so if u want to compile that file u should use javac -deprecation <filename.java> .
this would reduce the error to a warning . and u can easily run the program.

Impossible is I M Possible
Dirk Schreckmann

Joined: Dec 10, 2001
Posts: 7023
Let's be clear about something.

Compiling code that uses a deprecated method, without specifying the -deprecation switch, the compiler generates a warning - not an error - letting you know that a deprecated API was used by the just-compiled source code.

Compiling code that uses a deprecated method, while specifying the -deprecation switch*, generates a more detailed warning message, lising the line of code where the deprecated API was used.

In no case does using a deprecated API cause code to not be compiled.

* Note: With Java 2 v5, the compiler suggests using -XLint:deprecation switch.
[ September 17, 2004: Message edited by: Dirk Schreckmann ]
I agree. Here's the link: http://aspose.com/file-tools
subject: Deprecation compile option ????
It's not a secret anymore!