hi friends

when i am running my programe on cmd in C:\Programe File\jdk1.6.0_14\bin I got the message that file name.java uses or overrides a deprecated API . Recompile with -Xlint: deprecation for details . what it meant how it will solved . please help me

thanks in advance for reply
shashikant

Recommended Answers

All 26 Replies

by, instead of calling javac <filename> calling javac -Xlint:deprecation <filename> and letting the compiler tell you exactly what it doesn't like. The message, however, is only a warning.

Deprecation warnings are telling you that the API you're calling has been marked as unsuitable for long-term use. Generally, the documentation for that class will tell you what should be used instead--consult the Javadoc for the object you're using in your program and it should shed some light on the matter.

it is a common problem when dealing with applet so you need to create an applet to view the output or if not an applet program look at the compillation options given to you after compilling

it is a common problem when dealing with applet so you need to create an applet to view the output or if not an applet program look at the compillation options given to you after compilling

Huh? This is purely a compilation issue. What does applet, or not applet, have anything to do with it?

commented: thanks fo ur reply +1

It is just a warning !
http://www.j2ee.me/j2se/1.5.0/docs/api/java/lang/Deprecated.html


use "javac filename.java Xlint:deprecation"

It will tell you which method is deprecated
Search the Java Docs for the better equivalent

dear sir,

I am beginer in java and I am working on a project so that i am unable to solve the deprecation warning. so pls help how that warning will be solved.
pls help me.

thanks for ur reply

dear sir
thanks for ur reply
i am beginer in java and working on a project , and i am unable to solve the deprecation warning so pls help me how that warning will be solved. if necessary i can forward my code.
pls give reply as soon as possible.
thanks
shashikant

And have you used that option to javac, yet? Using an option on a command line is not a Java issue, and if you do not know how to provide options and arguments to a command on the command line then you need to learn that, first. And, as said, that is not a Java issue.

If it is that you are using an IDE and don't know how to set the options in the IDE, well, read the user documentation for your IDE and find out how.

Once you have the respective issue corrected, then do that. If you still don't understand what's wrong, then post here what that compilation attempt gave you and we will help you further.

P.S. PM's asking for help are summarily ignored.

Edit: If you simply want the warning to "go away" then use the "@Deprecated" annotation (Google that) or use the "-nowarn" or "-Xlint:none" options to javac.

It is just a warning !
http://www.j2ee.me/j2se/1.5.0/docs/api/java/lang/Deprecated.html


use "javac filename.java Xlint:deprecation"

It will tell you which method is deprecated
Search the Java Docs for the better equivalent

dear sir
i have gone through ur given reply but as a beginer in java i cant able to solve the problem of deprecation. so pls help me how the problem will be solved.
thanks
shashikant

And have you used that option to javac, yet? Using an option on a command line is not a Java issue, and if you do not know how to provide options and arguments to a command on the command line then you need to learn that, first. And, as said, that is not a Java issue.

If it is that you are using an IDE and don't know how to set the options in the IDE, well, read the user documentation for your IDE and find out how.

Once you have the respective issue corrected, then do that. If you still don't understand what's wrong, then post here what that compilation attempt gave you and we will help you further.

P.S. PM's asking for help are summarily ignored.

Edit: If you simply want the warning to "go away" then use the "@Deprecated" annotation (Google that) or use the "-nowarn" or "-Xlint:none" options to javac.

dear sir

i have eneterd the following on command prompt :
javac filename.java
but it is giving deprecated warning. for the overcome of deprecated warning where my code is deprecated i had given the following command
javac -Xlint deprecated file name.java
after putting the command 2 step were shown where the method is deprecated. but i am not able to solve the deprecated problem.
so pls help how it is solved.
if necessary i can forward my code to u .
thanks
shashikant

So, as I said, post what it was you got.

P.S. You hopefully did not actually type javac -Xlint deprecated file name.java but rather javac -Xlint:deprecation filename.java which is what the initial message said (for the option) and only common sense (for the argument) besides the fact that I had already explicitly posted that.

dear sir
i have gone through ur given reply but as a beginer in java i cant able to solve the problem of deprecation. so pls help me how the problem will be solved.
thanks
shashikant

It seems that you have not yet tried

"javac filename.java Xlint:deprecation"

method

try this or else
Post your code !

It seems that you have not yet tried

"javac filename.java Xlint:deprecation"

method

try this or else
Post your code !

You have it wrong, though. See above.

And have you used that option to javac, yet? Using an option on a command line is not a Java issue, and if you do not know how to provide options and arguments to a command on the command line then you need to learn that, first. And, as said, that is not a Java issue.

If it is that you are using an IDE and don't know how to set the options in the IDE, well, read the user documentation for your IDE and find out how.

Once you have the respective issue corrected, then do that. If you still don't understand what's wrong, then post here what that compilation attempt gave you and we will help you further.

P.S. PM's asking for help are summarily ignored.

Edit: If you simply want the warning to "go away" then use the "@Deprecated" annotation (Google that) or use the "-nowarn" or "-Xlint:none" options to javac.

So, as I said, post what it was you got.

P.S. You hopefully did not actually type javac -Xlint deprecated file name.java but rather javac -Xlint:deprecation filename.java which is what the initial message said (for the option) and only common sense (for the argument) besides the fact that I had already explicitly posted that.

sir
sorry for wrong sentence.
after wriitnig the javac -Xlint:deprecation filename.java i got the warning
"[deprecation] show() in java.awt.Dialog has been deprecated fd.show()"
in open and save dialog box.
pls reply as soon as possible.

You have it wrong, though. See above.

oh! sorry,

I forgot to put - sign before Xlint:deprecation

use:
"javac filename.java -Xlint:deprecation"

Thanx for pointing out my mistake !

oh! sorry,

I forgot to put - sign before Xlint:deprecation

use:
"javac filename.java -Xlint:deprecation"

Thanx for pointing out my mistake !

You also have the option in the wrong position relative to the filename list. That is rather important.

sir
sorry for wrong sentence.
after wriitnig the javac -Xlint:deprecation filename.java i got the warning
"[deprecation] show() in java.awt.Dialog has been deprecated fd.show()"
in open and save dialog box.
pls reply as soon as possible.

use

fd.setVisible(true);

instead of fd.show();

sir
sorry for wrong sentence.
after wriitnig the javac -Xlint:deprecation filename.java i got the warning
"[deprecation] show() in java.awt.Dialog has been deprecated fd.show()"
in open and save dialog box.
pls reply as soon as possible.

Okay. And have you looked at the API docs for Dialog to see if that method description suggests a solution?

You also have the option in the wrong position relative to the filename list. That is rather important.

You are write
But this also works fine

i have tried this !

oh! sorry,

I forgot to put - sign before Xlint:deprecation

use:
"javac filename.java -Xlint:deprecation"

Thanx for pointing out my mistake !

dear sir
i had use that also but the same is given as i have given in my previous post . how that deprecation warning will be solved . I had gone through ur link @Deprecated . i had used it in my program also as given in that page of deprecated. but still deprecation warning is flowing.

thanks for such an effort

You are write
But this also works fine

i have tried this !

Then only because the programmer decided to be generous, but since it is not documented this way do not count on it always working this way, and especially not with all options.

Edit: And, definately do not suggest that other's do it that way.

dear sir
i had use that also but the same is given as i have given in my previous post . how that deprecation warning will be solved . I had gone through ur link @Deprecated . i had used it in my program also as given in that page of deprecated. but still deprecation warning is flowing.

There may be any mistake because
Deprecation warning can be removed in this way only.

Check it may be at different location.

Deprecation warning can be removed in this way only.

Uhm, no. It can, and should be updated to use the "current" procedure, not to mention other javac options (which I already mentioned earlier).

Post your code or part of the code

if possible !

use

fd.setVisible(true);

instead of fd.show();

dear mr topest1

thanks for reply. your given code really work and now my problem is solved .
thanks for such cooperation
shashikant

dear mr topest1

thanks for reply. your given code really work and now my problem is solved .
thanks for such cooperation
shashikant

This is exactly what the API docs tell you. Did you even bother to look? No? You'd rather spend days begging at a forum for someone to do it for you than to take two minutes to RTFM and do it yourself? I can see your productivity in the workplace is just going to be through the roof!

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.