-Xlint:deprecation

I have the following code:
(BTW: theButton is a two-dimensional array of JButton objects)
theButton[0][0].enable(false);I've also tried:
theButton[0][0].disable();They both give me the same error:
Note: C:\.....\tttGUI.java uses or overrides a deprecated API.
Note: Recompile with -XLint:deprecation for details.Can anyone please help me with this???
This is a program that I'm doing as a small project for school, for a bit of extra credit. Thanks in advance!

This is a warning rather than an error - that is, your code will compile and run. But you are advised to change your code because what you have written is problematic in some way (won't be supported in the future etc).
The idea is that you do exactly what the message says, you recompile:javac -cp . -XLint:deprecation *.javaor whatever command it is that you compile with. The important bit is the "-XLint:deprecation" part. The compiler will tell you exactly what is wrong and is generally very good about telling you how to fix it.
(The fact that you have identified the disable() method as the culprit suggests that you have done this? Also I don't think enable(false) will give you the deprecation warning - it just won't compile.)
There is another way to see what you should do instead of disable() - read the API documentation. Again, it is very good at explaining what you should do when a particular method is deprecated. The API for JButton is here: http://java.sun.com/javase/6/docs/api/javax/swing/JButton.html

Similar Messages

  • Recompile with -Xlint:deprecation, whaat is it?

    Hi, all!
    When I'm compiling a prgm, I get this note: Recompile with Xlint:deprecation for details.
    buttons.java uses or overrides a deprecated API.
    I don't know what is it, and what does it prompt me to do.
    Your help is highly appreciated.

    An API you are using has been deprecated ^1^ (should no longer be used, for example Thread.stop ^2^ has been depricated as it is not safe to use).
    Compiling with "Xlint:deprecation" will tell you what you are using, you can then look that up in the API to tell you what you need to do instead.
    ^1^ http://en.wikipedia.org/wiki/Deprecation
    ^2^ http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Thread.html#stop()

  • Recompile with -Xlint :deprecation for details

    hi, i'm new in java
    i had tried to write one simple java applet, but when
    i compiled this message was come out:
    c:> javac applet1.java
    Note:applet1.java uses or overrides a depreciated API
    Note: recompile with -Xlint :deprecation for details

    hi, i'm new in java
    i had tried to write one simple java applet, but
    when
    i compiled this message was come out:
    c:> javac applet1.java
    Note:applet1.java uses or overrides a depreciated
    API
    Note: recompile with -Xlint :deprecation for detailsThis is a warning that means that a class or method that you are using in your code is deprecated. A class or a method can be deprecated for several reasons:
    e.g. the class/method could contain an error which makes the code unstable, the class/method could be written in a non standard way, the class/method could have been replaced by a more efficient/better/improved class/method
    The deprecation message is only a warning. The code will compile even when deprecated. However, most code is deprecated for a reason, so you should try to find out what the substitution is (if one exists).
    To find out what the problem is, the java compiler suggests you recompile using -Xlint: deprecation.
    So instead of compiling using
    javac YourClass.java
    type
    javac YourClass.java -Xlint:deprecation
    You should get a message such as:
    C:\Jenjava\Test\PacMan.java:56: warning: [deprecation] isFocusTraversable() in java.awt.Component has been deprecated
         public boolean isFocusTraversable(){
    Look up the offending method in the API at http://java.sun.com/j2se/1.5.0/docs/api/
    It says:
    isFocusTraversable
    @Deprecated
    public boolean isFocusTraversable()Deprecated. As of 1.4, replaced by isFocusable().
    So, to get rid of the warning (and use the current method) we replace the isFocusTraversable() with isFocusable().
    Make sense?
    :) jen

  • Deprecated API and RFC connection issues in PI 7.1

    Hi all,
    I am new to this Forum..
    I am working in File to Proxy scenario where i am using UDF to implemnt few functions.
    But i am getting the following Error :
    Source text of object Message Mapping: MM_FILE_10_943 | urn://fiat.com/mm/if_10_943 has syntax errors:
    Function sendMonitor, Line 14:
    cannot find symbol symbol  : class CallRFCManager location: class com.sap.xi.tf._MM_FILE_10_943_    CallRFCManager rfc=new CallRFCManager();    ^
    Function sendMonitor, Line 14:
    cannot find symbol symbol  : class CallRFCManager location: class com.sap.xi.tf._MM_FILE_10_943_    CallRFCManager rfc=new CallRFCManager();                           ^
    Function sendMonitor, Line 17:
    cannot find symbol symbol  : variable Constants location: class com.sap.xi.tf._MM_FILE_10_943_         if(rfc.connect(Constants.XISYSTEM)){                             ^ Note: /disk2/sap/TX0/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map9c6141de40a611e0ad290000003d38da/source/com/sap/xi/tf/_MM_FILE_10_943_.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: /disk2/sap/TX0/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map9c6141de40a611e0ad290000003d38da/source/com/sap/xi/tf/_MM_FILE_10_943_.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 3 errors
    The code i am using is:
       //write your code here
       // INPUT: activate ; id; descrizione
       AbstractTrace trace;
       String messID;
       java.util.Map map;
       trace = container.getTrace();
       map = container.getTransformationParameters();
       messID = (String) map.get(StreamTransformationConstants.MESSAGE_ID);
       CallRFCManager rfc=new CallRFCManager();
       if (a.equals("true")){
            if(rfc.connect(Constants.XISYSTEM)){     
                  try{
                        rfc.traceMonitor(messID,b,c);
                        trace.addInfo("Ok trace monitor");
                        rfc.disconnect();
                  } catch (Exception ex) {
                        trace.addInfo("Errore in sendMonitor CAUSA:" + ex.getMessage());
                        rfc.disconnect();
            }else{
                      trace.addInfo("Errore in sendMonitor CAUSA: errore sulla connessione ad XI"); 
       return a;
    Pleasae help me ....what is the reason for this ???

    Hi ,
    the package com.fiat.sapiens.udf.* is saved in the IA_JAVA.zip file.
    I imported it in the imported archive and added this jar in the import tab of function library
    i also added ti in the archive used tab in function.
    But still it is showing this Error.
    under IA_JAVA.zip  i have  testJCO.java which has the folowing code:
    package com.fiat.sapiens.xi.udf;
    // Referenced classes of package com.fiat.sapiens.xi.udf:
    //            CallRFCManager
    public class TestJCO
        public TestJCO()
        public static void main(String args[])
            System.setProperty("SAPSYSTEMNAME", "DX0");
            CallRFCManager rfc = new CallRFCManager();
            rfc.connect("XI");
            try
                rfc.schedNR("10", "20", "30", "40", "50", "60");
            catch(Exception e1)
                e1.printStackTrace();
            if(rfc.connect())
                rfc.connect();
                try
                    String a = rfc.checkRARCRE("ZZ");
                    System.out.println(a);
                catch(Exception e)
                    e.printStackTrace();
            System.out.println("");

  • User defined function in PI 7.1 compilation error "Recompile with -Xlint"

    Hi All,
    I have a user defined function in PI 7.1 .,which is throwing the following error.
    Do i need to add any import statements like "import java.lang.String" in the beginning.
    It is unable to recognize the String methods used in the user defined function.
    E:\usr\sap\PID\DVEBMGS30\j2ee\cluster\server0\.\temp\classpath_resolver\Map02580a102a0911deb2b20019990eddfd\source\com\sap\xi\tf\_MM_C_to_Goods_.java:276:
    cannot find symbol
    symbol : method trim()
    location: class java.lang.Object
    if(container.getParameter("AdjustmentQuantity").trim().startsWith("-")){ ^
    Note: E:\usr\sap\PID\DVEBMGS30\j2ee\cluster\server0\.\temp\classpath_resolver\Map02580a102a0911deb2b20019990eddfd\source\com\sap\xi\tf\_MM_C_to_Goods_.java
    uses or overrides a deprecated API.
    Note: Recompile with -Xlint:deprecation for details.
    Note: E:\usr\sap\PID\DVEBMGS30\j2ee\cluster\server0\.\temp\classpath_resolver\Map02580a102a0911deb2b20019990eddfd\source\com\sap\xi\tf\_MM_C_to_Goods_.java
    uses unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details.
    Any Help greatly appreciated..
    Collins

    container.getParameter() returns Object, not String.
    try following:
    String aq = (String) container.getParameter("AdjustmentQuantity");
    if(aq.trim().startsWith("-"))
    Regards
    Stefan

  • @SuppressWarnings("deprecation") is not working as described in the Tutoria

    @SuppressWarnings("deprecation") is not suppressing warnings when I compile the below code on SDK 1.6.0. This code is copied straight from the Java Tutorial page at http://java.sun.com/docs/books/tutorial/java/javaOO/QandE/annotations-answers.html
    Any hints would be appreciated.
    Thank you,
    Andrew Bloss
    public class MyHouse implements House {
        @SuppressWarnings("deprecation")
        public void open() {}
        public void openFrontDoor() {}
        public void openBackDoor() {}
    }I get the message
    "MyHouse.java uses or overrides a deprecated API."
    I copied both the interface and the code from the tutorial page. The message does appear if I replace
    @SuppressWarnings("deprecation") with
    @Deprecated.
    The interfac is
    public interface House {
         * @deprecated use of open is discouraged, use
         * openFrontDoor or openBackDoor instead.
        @Deprecated
        public void open();
        public void openFrontDoor();
        public void openBackDoor();
    }

    You have, as far as I can tell, found a bug in Sun's compiler.
    Java language Specification 3rd edition, p#9.6.1.6, says:
    9.6.1.6 Deprecated
    A program element annotated @Deprecated is one that programmers are discouraged from using, typically because it is dangerous, or because a better alternative exists. A Java compiler must produce a warning when a deprecated type, method, field, or constructor is used (overridden, invoked, or referenced by name) unless:
    The use is within an entity that itself is is annotated with the annotation @Deprecated; or
    The declaration and use are both within the same outermost class; or
    The use site is within an entity that is annotated to suppress the warning with the annotation @SuppressWarnings("deprecation")
    Use of the annotation @Deprecated on a local variable declaration or on a parameter declaration has no effect.
    Using Java 6, I verified that the following code issues a warning when compiled:
    interface House {
         * @deprecated use of open is discouraged, use
         * openFrontDoor or openBackDoor instead.
        @Deprecated
        public void open();
        public void openFrontDoor();
        public void openBackDoor();
    class MyHouse implements House {
        @SuppressWarnings("deprecation")
        public void open() {}
        public void openFrontDoor() {}
        public void openBackDoor() {}
    }The compiler produced these results:
    Note: Xy.java uses or overrides a deprecated API.
    Note: Recompile with -Xlint:deprecation for details.This bug (resolved in Mustang) may be involved.
    http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6394563

  • Suppress deprecated warning?

    My code is extending an abstract class. In the abstract class they have added a @deprecated tag above the no arg constructor. In my class I'm not defining a no arg constructor and I'm getting the warmingwarning: [deprecation] AbstractAuthenticationToken() in
    org.acegisecurity.providers.AbstractAuthenticationToken
    has been deprecated I've added -Xlint:-deprecation to my ant javac; no dice. I also added the @SuppressWarnings("deprecation") and declared my own no arg constructor and that didn't help either.
    I'm using 1.5.0_06-b05.
    Help! I hate warnings I can't do anything about and that aren't my fault!

    ctor is short for "constructor".
    You can't override constructors, anyway.
    You probably have this:
    public class MyClass extends ClassWithDeprecatedConstructor
        public MyClass(String text)
           System.out.println(text);
    }That code implicitly calls "super()" as the first line of MyClass. But, that constructor is deprecated. You want this:
    public class MyClass extends ClassWithDeprecatedConstructor
        public MyClass(String text)
           super(text, 5); // EXPLICITLY call a super constructor.
           System.out.println(text);
    }Where ClassWithDeprecatedConstructor takes a String and an int:
    public ClassWithDeprecatedConstructor(String text, int num)
    }

  • Deprecated API error??`

    hi!
    i m getting this error :
    Note: FileInputDemo.java uses or overrides a deprecated API.
    Note: Recompile with -Xlint:deprecation for details.
    for the code:
    /* * * FileOutputDemo
    * * Demonstration of FileOutputStream and
    * PrintStream classes
    import java.io.*;
    class FileInputDemo {
    public static void main(String args[]) {
         if (args.length == 1) {
              try {
                   // Open the file that is the first
                   // command line parameter
                   FileInputStream fstream = new FileInputStream(args[0]);
                        // Convert our input stream to a
                        // DataInputStream
                        DataInputStream in = new DataInputStream(fstream);
                        // Continue to read lines while
                        // there are still some left to read
                        while (in.available() !=0) {
                             // Print file line to screen
                             System.out.println (in.readLine());
                        in.close();
                   catch (Exception e) {
                        System.err.println("File input error");
              else System.out.println("Invalid parameters");
    someone plz help me!!
    thanks
    :)

    i m getting this error :It is a "note" or warning, not an error.
    Note: FileInputDemo.java uses or overrides a deprecated API.
    Note: Recompile with -Xlint:deprecation for details.Have you tried recompiling it with -Xlint:deprecation?

  • How to find deprecated code

    Hi there
    I've just been handed over a great big project that was coded a couple of years ago and have just recompiled most of it - problem is that the compiler keeps telling me that the code has deprecated stuff in it but it won't tell me WHERE! (I'm using netbeans 4.1, Java 5.0)
    Does anyone know of a tool that can pick out deprecated code or wether netbeans can do this please?
    Cheers
    JJ

    C:\temp>javac someApplet.java
    Note: someApplet.java uses or overrides a deprecated API.
    Note: Recompile with -Xlint:deprecation for details.
    C:\temp>javac -Xlint:deprecation someApplet.java
    someApplet.java:9: warning: [deprecation] stop() in java.lang.Thread has been de
    precated
    Thread.currentThread().stop();
    ^
    1 warning

  • How to configure in build the option "Xlint:deprication"

    Hi all,
    how I can define the "Xlint:deprication" option in Eclipse?
    I would follow the warning:
         [javac] WARNING: Note: Some input files use or override a deprecated API.
         [javac] WARNING: Note: Recompile with -Xlint:deprecation for details.
         [javac] WARNING: Note: Some input files use unchecked or unsafe operations.
         [javac] WARNING: Note: Recompile with -Xlint:unchecked for details.
    But I don't know, how to do this.
    Can you help?
    Thanks
    Sven

    Hi Sven,
    Have you checked your settings under <em>Java u2192 Compiler u2192 Errors/Warnings</em> section <em>Deprecated and restricted API</em> (either project settings if defined there or the general settings)? As long as I don't have configure to give error messages for deprecated features I can still use them and the compiler doesn't complain (or spits out just a warning depending on what I set).
    Cheers, harald

  • Login page  and -Xlint message on compilation

    i have a login page which ought to call up another page once the password entered corresponds with the data on the table in the database.
    I tried to compile the code in the file Enter.java and i got the following message on the command prompt:
    NOTE: Enter.java uses or overrides a deprecated API.
    NOTE: Recompile with -Xlint:deprecation for details.
    WHAT DOES IT MEAN TO RECOMPILE WITH -Xlint?
    Any idea what this is about and how to circumvent it?

    that's means that you've used a deprecated method in your java code.
    recompile your code as the following:
    javac -Xlint MyClass.java
    See http://java.sun.com/j2se/1.5.0/docs/tooldocs/solaris/javac.html for more information

  • Note: ImageViewer.java uses or overrides a deprecated API.

    hi,
    iam gettin this error after compilation
    Note: ImageViewer.java uses or overrides a deprecated API.
    Note: Recompile with -Xlint:deprecation for details.
    & am running it on j2sdk1.5.0
    Plzzz help

    waoh man......but what 2 look....
    heres da code...
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.image.*;
    import java.io.*;
    import javax.swing.*;
    public class ImageViewer
    public static void main(String[] args)
    JFrame frame = new ImageViewerFrame();
    frame.setTitle("ImageViewer");
    frame.setSize(300, 400);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.show();
    class ImageViewerFrame extends JFrame
    public ImageViewerFrame()
    // set up menu bar
    JMenuBar menuBar = new JMenuBar();
    setJMenuBar(menuBar);
    JMenu menu = new JMenu("File");
    menuBar.add(menu);
    JMenuItem openItem = new JMenuItem("Open");
    menu.add(openItem);
    openItem.addActionListener(new FileOpenListener());
    JMenuItem exitItem = new JMenuItem("Exit");
    menu.add(exitItem);
    exitItem.addActionListener(new
    ActionListener()
    public void actionPerformed(ActionEvent event)
    System.exit(0);
    // use a label to display the images
    label = new JLabel();
    Container contentPane = getContentPane();
    contentPane.add(label, "Center");
    private class FileOpenListener implements ActionListener
    public void actionPerformed(ActionEvent evt)
    // set up file chooser
    JFileChooser chooser = new JFileChooser();
    chooser.setCurrentDirectory(new File("."));
    // accept all files ending with .gif
    chooser.setFileFilter(new
    javax.swing.filechooser.FileFilter()
    public boolean accept(File f)
    return f.getName().toLowerCase()
    .endsWith(".gif")
    || f.isDirectory();
    public String getDescription()
    return "GIF Images";
    // show file chooser dialog
    int r = chooser.showOpenDialog(ImageViewerFrame.this);
    // if image file accepted, set it as icon of the label
    if(r == JFileChooser.APPROVE_OPTION)
    String name
    = chooser.getSelectedFile().getPath();
    label.setIcon(new ImageIcon(name));
    private JLabel label;
    }

  • Show error overrides a deprecated API ?

    hi,
    when my java program run, it shows,
    Note: D:\javaexample\myJavaPgm.java uses or overrides a deprecated API.
    Note: Recompile with -Xlint:deprecation for details.
    what this error message.
    Can I ignore this warning ?.
    or how can i solve this warning?.

    hi,
    when my java program run, it shows,
    Note: D:\javaexample\myJavaPgm.java uses or overrides
    a deprecated API.
    Note: Recompile with -Xlint:deprecation for details.
    what this error message.
    Can I ignore this warning ?.
    or how can i solve this warning?.Deprecation means a method or class has been identified as obsolete. That means that there is a newer and better alternative to something you are doing. It also means that perhaps one day the deprecated thing will disappear from the API (unlikely probably but could happen).
    To solve the warning you will have to find out what it's complaining about.
    javac -deprecation myJavaPgm.javaWill tell you what exactly is the problem.
    Then you can look in the API for alternatives.

  • Need help with java uses or overrides a deprecated API.

    i have some issues and have not clue where the issue is this is the error that i receive
    Note: C:\Documents and Settings\Adam\My Documents\JCreator LE\MyProjects\Pokemon\src\Pokemon.java uses or overrides a deprecated API.
    Note: Recompile with -Xlint:deprecation for details.
    here is my code

    public void boundry()
                   int i;
                   //System.out.println("y is "+  (y+23) );
                   //System.out.println("x is "+ (x+17) );
                   //X10=wall[1].getX();
                   //System.out.println("wall[1]X is" + X10);
                   //check to see if over boundary
                   rightflag=2;
                   leftflag=2;
                   downflag=2;
                   upflag=2;
              for(i=0; i<=8; i++)
                   System.out.println("i is" +i);
                    //left side
                    if ( ( (x+17) > (wall.getX() ) )
                   && ( (y) < (wall[i].getY() + wall[i].getHeight()-5) )
                   && ( (y+23) > (wall[i].getY()+5 ))
                   && ( (x) < (wall[i].getX() + (wall[i].getWidth()/2) )) )
                        rightflag=1;
                        System.out.println("left");
                   else
                        rightflag=2;
                   //right side
                   if ( ( (x) < ((wall[i].getX() + wall[i].getWidth() )))
                   && ( (y) < wall[i].getY() + wall[i].getHeight()-5 )
                   && (y > (wall[i].getY() ))
                   && ( (x) > ((wall[i].getX()+(wall[i].getWidth()/2))) ) )
                        leftflag=1;
                        System.out.println("right");
                   else
                        leftflag=2;
                   //top side
                   if ( ( (y+23) > wall[i].getY() )
                   && ( (y+23) < ( wall[i].getY() + (wall[i].getHeight()/2-5) ))
                   && ( (x+17) > wall[i].getX())
                   && ( (x) < (wall[i].getX()+(wall[i].getWidth() ))) )
                   upflag=1;
                        System.out.println("top");
                   else
                        upflag=2;
                   //bottom boundry
                   if(
                   (y < (wall[i].getY()+wall[i].getHeight() ))
                   && (y > (wall[i].getY() ))
                   && ((x+17) > (wall[i].getX()))
                   && (x < (wall[i].getX()+wall[i].getWidth() ) ))
                        downflag=1;
                        System.out.println("bottom");
                   else
                        downflag=2;
                   System.out.println("test");
                   //stop them from being over boundary
                   if (rightflag==1)
                   x=x-10;
                   else if (leftflag==1)
                   x=x+10;
                   else if (upflag==1)
                   y=y-10;
                   else if (downflag==1)
                   y=y+10;
                   //draw the player
              public boolean handleEvent (Event e)
                   //Get the scroll bars to work
                   Y2 = indicatestrength.getValue();
                   Y3 = X2.getValue();
                   Y4 = Width2.getValue();
                   Y5 = height2.getValue();
                   repaint();
                   return true;
              public void save ()     
                   File dataFile = new File ("Users/jeffrey/Server/Test.rtf");
                   FileWriter out;
                   BufferedWriter writeFile;
                   //sample data to write
                   double testnumber = -34.454;
                   String testname="this is a string";
              try{
                   out =new FileWriter (dataFile);
                   writeFile = new BufferedWriter(out);
                   //write all data as strings
                   writeFile.write(testname);
                   writeFile.newLine();
                   writeFile.write(String.valueOf(testnumber));
                   writeFile.newLine();
                   //Close file
                   writeFile.close();
                   out.close();
                   System.out.println ("data written to file");
                   catch (IOException e)
                        System.out.println("there was a error writing to the file");

  • Recompile with Xlint Message

    hi, i'm new in java
    i had tried to write one simple java applet, but when
    i compiled this message was come out:
    c:> javac applet1.java
    Note:applet1.java uses or overrides a depreciated API
    Note: recompile with -Xlint :deprecation for details

    Hi , where are the instructions to follow ????
    I have got this error too .
    java uses or overrides a deprecated API.
    Note: Recompile with -Xlint:deprecation for details.
    I was using jdk1.4 before and my program works fine , but when I started using jdk1.5 I have go the above problem .u tell me how to fix it.

Maybe you are looking for

  • MASS_ vendor changes

    All, I'm trying to change the vendors master via MASS transaction. I'm doing only purchasing block and CC block.  Some vendors have some errors. I got  red light with message number with no description of message.  How do I veiw the error? Some vednd

  • Re-Obtaining purchased music after a computer crash- How do you do it??

    I've had a Gateway laptop for the last 2 1/2 years. It's been working well for me until about a month ago when it got a virus and crashed. I took it in and all my files were lost, including my music. When I first got this laptop and downloaded iTunes

  • How to remove an LOV Mapping in iProcurement Page..

    Hi All, In the iProcurement page, there is an LOV mapping for the LOV Expenditure Type. I need to remove the criteria item for one of the LOV mapping. Can any one please help me on how to remove Criteria Item in the LOV mapping. Regards, Ramakrishnan

  • My Photoshop CS6 is creating some problem.

    My Photoshop CS6 is creating some problem.....whenever I am opening it, the software is crashing, showing " Adobe Photoshop CS6 stopped working ".....What should I do ?

  • Photoshop elements 13 choix impression photo

    J'ai remplacé mon vieil iMac par un iMac dernière version depuis 3 semaines avec Mac OSX Yosemite et j'ai du acheter photoshop elements 13 Lorsque j'ouvre plusieurs  photos en même temps et que je crée un assemblage de ces photos sur un nouveau docum