aspose file tools*
The moose likes Ant, Maven and Other Build Tools and the fly likes Getting rid of warning Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Getting rid of warning" Watch "Getting rid of warning" New topic
Author

Getting rid of warning

Shweta Grewal
Ranch Hand

Joined: Apr 03, 2012
Posts: 39
I am using ant to compile a package, it gives following warning repeatedly:
warning: sun.misc.BASE64Encoder is Sun proprietary API and may be removed in a future release
[javac] BASE64Encoder encoder = new BASE64Encoder();

How can I get rid of the warning?
linda russel
Ranch Hand

Joined: Jan 05, 2012
Posts: 86
Your best option would be to fix the use of deprecated APIs. However, an option would be to add the @SupressWarnings("deprecation") annotation to the classes or methods that are using the deprecated APIs.
Shweta Grewal
Ranch Hand

Joined: Apr 03, 2012
Posts: 39
add the @SupressWarnings("deprecation") annotation to the classes or methods that are using the deprecated APIs.

How to do that?
linda russel
Ranch Hand

Joined: Jan 05, 2012
Posts: 86
Are you doing any kind of automation?
linda russel
Ranch Hand

Joined: Jan 05, 2012
Posts: 86
you need to add those annotations to your tests to ignore
Shweta Grewal
Ranch Hand

Joined: Apr 03, 2012
Posts: 39
you need to add those annotations to your tests to ignore

I am sorry still didnot get it.
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10210
    
166

Shweta Grewal wrote:
you need to add those annotations to your tests to ignore

I am sorry still didnot get it.


What is the Java file which is using this:



[My Blog] [JavaRanch Journal]
Shweta Grewal
Ranch Hand

Joined: Apr 03, 2012
Posts: 39
There are a lot of them I cant change all of them.
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10210
    
166

Shweta Grewal wrote:There are a lot of them I cant change all of them.


Then the only way to get rid of those warning messages is to set the nowarn attribute of Ant's javac task http://ant.apache.org/manual/Tasks/javac.html in your build file.
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10210
    
166

By the way, whoever is using that sun.misc.BASE64Encoder class shouldn't be using it. I don't this those classes will be able to compile/run against anything other than Sun/Oracle JDK/JRE.

Shweta Grewal
Ranch Hand

Joined: Apr 03, 2012
Posts: 39
Then the only way to get rid of those warning messages is to set the nowarn attribute of Ant's javac task

Not working.I set nowarn attribute to "yes" but still there are warnings
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10210
    
166

Shweta Grewal wrote:
Then the only way to get rid of those warning messages is to set the nowarn attribute of Ant's javac task

Not working.I set nowarn attribute to "yes" but still there are warnings


Post the relevant snippet from your build.xml which contains this change and also post the entire log output which shows this warning.
Shweta Grewal
Ranch Hand

Joined: Apr 03, 2012
Posts: 39
<javac srcdir="${src}" destdir="${build}/${webapp_name}/WEB-INF/classes" debug="on" encoding="iso-8859-1" nowarn="Yes">
</javac>
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10210
    
166

Shweta, it's not going to help if you don't fully read the replies and provide relevant answers for the questions. Please read my previous post again and post what's asked for. We might have more questions later on, to see why it isn't working, this is just a start.
 
jQuery in Action, 2nd edition
 
subject: Getting rid of warning