• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Deprecation compile option ????

 
Shara Woods
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 7023
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
javac -deprecation Foo.java
 
Mahesh Bhatt
Ranch Hand
Posts: 88
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi

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.
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic