Deprecated API on a method.

I am getting a deprecated API warning when using the JTextField.getText() method. How do I find what method I should use instead? Is there a list somewhere with the replacements? Does someone know what to use instead of that method?

Yeah sorry guys I was using both a JTextField and a JPasswordField and I see now that you should use the method getPassword() for that. Sorry to bother everyone!!!

Similar Messages

  • Deprecated API compilation error

    Please help. Attached is my source code. I'm receiving a compilation error that reads 'RnrBooksApp.java uses or overrides a deprecated API. Recompile with -deprecation for details.' I'm very new to Java, so I appreciate any assistance. Thank you!
    //ClassName: RnrBooksApp
    import java.sql.*;
    import java.awt.*;
    import java.awt.event.*;
    public class RnrBooksApp extends Frame implements ItemListener, ActionListener
         //Declare database variables
         Connection conBook;
         Statement cmdBook;
         ResultSet rsBook;
         boolean blnSuccessfulOpen = false;
         //Declare components
         Choice lstBooks               = new Choice();
         TextField txtISBN          = new TextField(13);
         TextField txtTitle          = new TextField(50);
         TextField txtAuthor = new TextField(30);
         TextField txtPublisher     = new TextField(30);
         Button btnAdd      = new Button("Add");
         //Button btnUpdate = new Button("Update");
         Button btnEdit     = new Button("Save");
         Button btnCancel = new Button("Cancel");
         Button btnDelete = new Button("Delete");
         Label lblMessage = new Label(" ");
         public static void main(String args[])
              //Declare an instance of this application
              RnrBooksApp thisApp = new RnrBooksApp();
              thisApp.createInterface();
         public void createInterface()
              //Load the database and set up the frame
              loadDatabase();
              if (blnSuccessfulOpen)
                   //Set up frame
                   setTitle("Books Database");
                   addWindowListener(new WindowAdapter()
                                  public void windowClosing(WindowEvent event)
                                  stop();
                                  System.exit(0);
                   setLayout(new BorderLayout());
                   //Set up top panel
                   Panel pnlTop = new Panel(new GridLayout(2, 2, 10, 10));
                   pnlTop.add(new Label("ISBN"));
                   lstBooks.insert("Select a Book to Display", 0);
                   lstBooks.addItemListener(this);
                   pnlTop.add(lstBooks);
                   pnlTop.add(new Label(" "));
                   add(pnlTop, "North");
                   //Set up center panel
                   Panel pnlMiddle = new Panel(new GridLayout(5, 2, 10, 10));
                   pnlMiddle.getInsets();
                   pnlMiddle.add(new Label("ISBN"));
                   pnlMiddle.add(txtISBN);
                   pnlMiddle.add(new Label("Title"));
                   pnlMiddle.add(txtTitle);
                   pnlMiddle.add(new Label("Author"));
                   pnlMiddle.add(txtAuthor);
                   pnlMiddle.add(new Label("Publisher"));
                   pnlMiddle.add(txtPublisher);
                   setTextToNotEditable();
                   Panel pnlLeftButtons = new Panel(new GridLayout(0, 2, 10, 10));
                   Panel pnlRightButtons = new Panel(new GridLayout(0, 2, 10, 10));
                   pnlLeftButtons.add(btnAdd);
                   btnAdd.addActionListener(this);
                   pnlLeftButtons.add(btnEdit);
                   btnEdit.addActionListener(this);
                   pnlRightButtons.add(btnDelete);
                   btnDelete.addActionListener(this);
                   pnlRightButtons.add(btnCancel);
                   btnCancel.addActionListener(this);
                   btnCancel.setEnabled(false);
                   pnlMiddle.add(pnlLeftButtons);
                   pnlMiddle.add(pnlRightButtons);
                   add(pnlMiddle, "Center");
                   //Set up bottom panel
                   add(lblMessage, "South");
                   lblMessage.setForeground(Color.red);
                   //Display the frame
                   setSize(400, 300);
                   setVisible(true);
              else
                   stop(); //Close any open connection
                   System.exit(-1); //Exit with error status
         public Insets insets()
              //Set frame insets
              return new Insets(40, 15, 15, 15);
         public void loadDatabase()
              try
                   //Load the Sun drivers
                   Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
              catch (ClassNotFoundException err)
                   try
                   //Load the Microsoft drivers
                   Class.forName("com.ms.jdbc.odbc.JdbcOdbcDriver");
                   catch (ClassNotFoundException error)
                   System.err.println("Drivers did not load properly");
              try
                   //Connect to the database
                   conBook = DriverManager.getConnection("jdbc:odbc:Book");
                   //Create a ResultSet
                   cmdBook = conBook.createStatement();
                   rsBook = cmdBook.executeQuery(
                        "Select * from Book;");
                   loadBooks(rsBook);
                   blnSuccessfulOpen = true;
              catch(SQLException error)
                   System.err.println("Error: " + error.toString());
         public void loadBooks(ResultSet rsBook)
              //Fill ISBN list box
              try
                   while(rsBook.next())
                   lstBooks.add(rsBook.getString("ISBN"));
              catch (SQLException error)
                   System.err.println("Error in Display Record." + "Error: " + error.toString());
         public void itemStateChanged(ItemEvent event)
              //Retrieve and display the selected record
              String strISBN = lstBooks.getSelectedItem();
              lblMessage.setText(""); //Delete instructions
              try
                   rsBook = cmdBook.executeQuery(
                        "Select * from Book where [ISBN] = '"
                        + strISBN + "';");
                   txtISBN.setText(strISBN);
                   displayRecord(rsBook);
                   setTextToEditable();
              catch(SQLException error)
                   lblMessage.setText("Error in result set. " + "Error: " + error.toString());
         public void displayRecord(ResultSet rsBook)
              //Display the current record
              try
                   if(rsBook.next())
                        txtTitle.setText(rsBook.getString("Title"));
                        txtAuthor.setText(rsBook.getString("Author"));
                        txtPublisher.setText(rsBook.getString("Publisher"));
                        lblMessage.setText("");
                   else
                        lblMessage.setText("Record not found");
                        clearTextFields();
              catch (SQLException error)
                   lblMessage.setText("Error: " + error.toString());
         public void actionPerformed(ActionEvent event)
              //Test the command buttons
              Object objSource = event.getSource();
              if(objSource == btnAdd && event.getActionCommand () == "Add")
                   Add();
              else if (objSource == btnAdd)
                   Save();
              else if(objSource == btnEdit)
                   Edit();
              else if(objSource == btnDelete)
                   Delete();
              else if(objSource == btnCancel)
                   Cancel();
         public void setTextToNotEditable()
              //Lock the text fields
              txtISBN.setEditable(false);
              txtTitle.setEditable(false);
              txtAuthor.setEditable(false);
              txtPublisher.setEditable(false);
         public void setTextToEditable()
              //Unlock the text fields
              txtISBN.setEditable(true);
              txtTitle.setEditable(true);
              txtAuthor.setEditable(true);
              txtPublisher.setEditable(true);
         public void clearTextFields()
              //Clear the text fields
              txtISBN.setText("");
              txtTitle.setText("");
              txtAuthor.setText("");
              txtPublisher.setText("");
         public void Add()
              //Add a new record
              lblMessage.setText(" ");     //Clear previous message
              setTextToEditable();                //Unlock the text fields
              clearTextFields();                //Clear text field contents
              txtISBN.requestFocus ();
              //Set up the OK and Cancel buttons
              btnAdd.setLabel("OK");
              btnCancel.setEnabled(true);
              //Disable the Delete and Edit buttons
              btnDelete.setEnabled(false);
              btnEdit.setEnabled(false);
         public void Save()
                        //Save the new record
                        // Activated when the Add button has an "OK" label
                        if (txtISBN.getText().length ()== 0 || txtAuthor.getText().length() == 0)
                             lblMessage.setText("The ISBN or Author is blank");
                        else
                             try
                                  cmdBook.executeUpdate("Insert Into Book "
                                            + "([ISBN], [Title], [Author], [Publisher]) "
                                            + "Values('"
                                            + txtISBN.getText() + "', '"
                                            + txtTitle.getText() + "', '"
                                            + txtAuthor.getText() + "', '"
                                            + txtPublisher.getText() + "')");
                                  //Add to name list
                                  lstBooks.add(txtISBN.getText());
                                  //Reset buttons
                                  Cancel();
                             catch(SQLException error)
                                  lblMessage.setText("Error: " + error.toString());
         public void Delete()
                        //Delete the current record
                        int intIndex = lstBooks.getSelectedIndex();
                        String strISBN = lstBooks.getSelectedItem();
                        if(intIndex == 0)          //Make sure a record is selected
                                                      //Position 0 holds a text message
                             lblMessage.setText("Please select the record to be deleted");
                        else
                             //Delete the record from the database
                             try
                                  cmdBook.executeUpdate(
                                       "Delete from Book where [ISBN] = '" + strISBN + "';");
                                  clearTextFields();               //Delete from screen
                                  lstBooks.remove(intIndex);          //Delete from list
                                  lblMessage.setText("Record deleted");     //Display message
                             catch(SQLException error)
                                  lblMessage.setText("Error during Delete."
                                       + "Error: " + error.toString());
         public void Cancel()
                        //Enable the Delete and Edit buttons
                        btnDelete.setEnabled(true);
                        btnEdit.setEnabled(true);
                        //Disable the Cancel button
                        btnCancel.setEnabled(false);
                        //Change caption of button
                        btnAdd.setLabel("Add");
                        //Clear the text fields and status bar
                        clearTextFields();
                        lblMessage.setText("");
         public void Edit()
                        //Save the modified record
                        int intIndex = lstBooks.getSelectedIndex();
                        if(intIndex == 0)          //Make sure a record is selected
                                                      //Position 0 holds a text message
                             lblMessage.setText("Please select the record to change");
                        else
                             String strISBN = lstBooks.getSelectedItem();
                             try
                                  cmdBook.executeUpdate("Update Book "
                                       + "Set [ISBN] = '" + txtISBN.getText() + "', "
                                       + "[Title] = '" + txtTitle.getText() + "', "
                                       + "[Author] = '" + txtAuthor.getText() + "', "
                                       + "[Publisher] = '" + txtPublisher.getText() + "' "
                                       + "Where [ISBN] = '" + strISBN + "';");
                                  if (!strISBN.equals(txtISBN.getText()))
                                       //Last name changed; change the list
                                       lstBooks.remove(intIndex); //Remove the old entry
                                       lstBooks.add(txtISBN.getText()); //Add the new entry
                             catch(SQLException error)
                                  lblMessage.setText("Error during Edit. " + "Error: " + error.toString());
         public void stop()
              //Terminate the connection
              try
                   if (conBook != null)
                   conBook.close();
              catch(SQLException error)
                   lblMessage.setText("Unable to disconnect");

    How DO you compile then?
    If you don't type "javac", you must be using an IDE.
    In your IDE there should be some kind of configuration
    tab or option for "compiler options" or compilation options
    or compiler arguments... something like that.
    put "-deprecation" in that text box and recompile.
    Your compiler should tell you all about which methods
    are deprecated -- you then go to your trust JavaDocs
    and lookup those methods in the API and read WHY they
    are deprecated (i.e. OLD, outdated, defunct, no longer used)
    and what you should use instead. Then, correct your
    code to no longer use the deprecated methods and instead
    do things as suggested in the deprecation comments.

  • Error: overrides a deprecated API

    Hi:
    I get the following error when I try to compile my code:
    Note: CalendarTest.java uses or overrides a deprecated API. Recompile with "-deprecation" for details.
    1 warning
    How do I solve the problem?
    Thanks.
    Describes a calendar for a set of appointments.
    @version 1.0
    import java.util.Vector;
    import java.util.*;
    public class CalendarTest
    {  public static void main(String[] args)
          Calendar markCalendar = new Calendar("Mark");
          Date start = new Date(2003 - 1900, 5 /*June*/, 2, 15, 0, 0);
          Date end = new Date(2003 - 1900, 5, 2, 16, 0, 0);
          markCalendar.addApp(new Appointment(start, end, "doctor"));
          markCalendar.print();     
    Describes a calendar for a set of appointments.
    class Calendar
       Constructs a calendar for the person named.
       public Calendar(String aName)
       {  name = aName;
          appointments = new Vector();
       Adds an appointment to this Calendar.
       @param anApp The appointment to add.
       public void addApp(Appointment anApp)
          appointments.add(anApp);
       Removes an appointment from this Calendar.
       @param anApp The appointment to be removed.
       public void removeApp(Appointment toFind)
          for ( int i = 0; i < appointments.size(); i++)
             if (((Appointment)appointments.get(i)).equals(toFind))
                 appointments.remove(i);
       Tests for duplicate appointment dates.
       public void dupsTest()
          for (int x = 0; x < appointments.size(); x++)
             Appointment check = (Appointment)appointments.get(x);
             for (int y = appointments.size()-1; y > x; y --)
                Appointment nextApp =(Appointment) appointments.get(y);
                if (check.match(nextApp))
                {  System.out.println("Duplicate appointments: ");
                   check.print();
                   nextApp.print();
       Prints the Calendar.
       public void print()
       {  System.out.println(name + "               C A L E N D A R");
          System.out.println();
           System.out.println("Date   Starttime    EndTime   Appointment");
          for (int i = 0; i < appointments.size(); i++)
          {  Appointment nextApp =(Appointment) appointments.get(i);
             nextApp.print();
       private Vector appointments;
       private String name;
       private Appointment theAppointment;
    Describes an appointment.
    class Appointment
       public Appointment(Date aStarttime,Date aEndtime, String aApp)
          starttime = aStarttime;
          endtime = aEndtime;  
          app = aApp;
    Method to test whether on object equals another.
    @param otherObject  The other object.
    @return true if equal, false if not
    public boolean equals(Object otherObject)
          if (otherObject instanceof Appointment)
          {  Appointment other = (Appointment)otherObject;
             return (date.equals(other.date) && starttime.equals(other.starttime)
                     && endtime.equals(other.endtime) && app.equals(other.app));
           else return false;
    Method to test whether part of an object equals another.
    @param otherObject  The other object.
    @return true if equal, false if not
    public boolean match(Object otherObject)
        if (otherObject instanceof Appointment)
         {  Appointment other = (Appointment)otherObject;
            return (date.equals(other.date) && starttime.equals(other.starttime)
                    && endtime.equals(other.endtime));
          else return false;
       Prints the Date, Starttime, Endtime and a description of the
       appointment.
       public void print()  
       {  System.out.println();
          System.out.println(date + "   " + starttime + "          " + endtime
              + "       " + app );
          System.out.println();
       private Date starttime;
       private Date endtime;
       private String app;

    The methods you used to instantiate your new dates has been deprecated and should no longer be used. This is just a warning though and your code will still work. Sun is just telling you that they no longer support those constructors for the Date class and that future releases of J2SE may not have them included in the API. If you wanted to, you could ignore it, or you could use the sample code instead for your Date creations:
    //need the following additional import
    import java.text.*;
    //HH is hours (0-23) see SimpleDateFormat for others
    DateFormat formatter = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
    Date start= formatter.parse("06/02/2003 15:00:00");
    Date end = formatter.parse("06/02/2003 16:00:00");tajenkins

  • Deprecated API?

    Since I installed the last JDK update, I get the same warning:
    MyFrame.show(): Deprecated API, show() in java.awt.Window has been deprecated.
    But I try to find in Sun site, and at the method description it's not deprecated yet...
    Any idea? What should I use instead of MyFrame.show()?

    Yeah, that is, I'm a little sleepy yet...
    If you want to know, java.awt.Window.show() should be replaced by Component.setVisible(true).

  • Deprecated api in 1.2.1

    compiling samp10.java
    samp10.java:32: Note: The method java.net.URL createURL(java.lang.String) in class oracle.xml.sql.dml.OracleXMLSave has been deprecated.
    URL url = sav.createURL(fileName);
    ^
    Note: samp10.java uses a deprecated API. Please consult the documentation for a
    better alternative.
    2 warnings

    Ignore what I said. I misread the message. The createURL needs to be changed to getURL in samp10.
    Thanks

  • 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.

  • What's this mean? - "uses or overrides a deprecated API."

    Hi, I'm a newbie at Java and I'm getting this error when I try to compile my program:
    "Note: C:\MarsLander\NewUser.java uses or overrides a deprecated API.
    Note: Recompile with -deprecation for details."
    I haven't a clue what is going on here, can anybody help?

    Methods and classes may get deprecated with the threat that they will be removed form the API in a future version. Deprecated things can be but should not be used.
    (Deprecated features can be undeprecated in a future version though. There are at least tow examples for this.)
    As the message tells, compile it with the -deprecation flag and the compiler will report which method or class it is about.

  • JRadioButton,ButtonGroup,overrides a deprecated API

    Hi guys,
    I need to know which JRadioButton is selected in a ButtonGroup. I have to methods to do it. The problem is that I need to communicate this to other class is in other file. I have enclosed a JRadioButton variable in the other class importing javax.swing.*. But I get this warning in that class when compiling.
    Note: J:\MainObjectClass.java uses or overrides a deprecated API.
    Note: Recompile with -deprecation for details.
    1)
    public static JRadioButton getSelection(ButtonGroup group) {
    for (Enumeration e=group.getElements(); e.hasMoreElements(); ) {
    JRadioButton b = (JRadioButton)e.nextElement();
    if (b.getModel() == group.getSelection()) {
    return b;
    return null;
    On the other hand, I hava tried a different way, defining the second method. But I get the same warning in the main class now.
    2)
    public static String getSelection(ButtonGroup group) {
    for (Enumeration e=group.getElements(); e.hasMoreElements(); ) {
    JRadioButton b = (JRadioButton)e.nextElement();
    if (b.getModel() == group.getSelection()) {
    return b.getLabel();
    return null;
    Does somebody what I can do?????
    Thanks in advance.

    If you recompile with -deprecation you see which classes/methods are deprecated and you can use something else. You can also use the deprecated methods, but there's no compelling reason to do so.

  • Deprecated API results

    Hello !
    When I compile the following code it says
    " CharacterCheck.java uses or overrides a deprecated API.
    Recompile with -deprecation for details. "
    What do I do ?
    class CharacterCheck {
    public static void main(String[] args) {
        char ch = 'A' ;
        boolean is_digit = false , is_space = false , is_other = false ;
        if(Character.isDigit(ch))
          is_digit = true ;
          else
              if (Character.isSpace(ch))
              is_space = true ;
              else
                  is_other = true ;
          System.out.print("\n\tCharacter Check : "   );
          System.out.println(is_digit) ;
    }God bless you .
    NADEEM.

    to get details as to why you're getting the message,
    compile your program with the -drprication option.
    javac -deprication CharacterCheck.java
    This will show you that what method call is being depricated.
    In your example it's the Character.isSpace(ch) method call that is generating the depricated message.

  • Force use of deprecated API to fail compilation

    Ok, short question that I hope you can help me with. Is it possible to force the compilation to fail if I a deprecated API is used. Why? Well, we are a large number of developers and sometimes people use a method or class that has been deprecated because they are either lazy or can't find the new class/method.

    This isn't possible with the default compiler. You would have to write a special compiler wrapper that calls the java compiler (sun.tools.javac.Main in tools.jar)
    Can't you just hang a rubber chicken over the desk of the person who checked in bad code - that was what happened at my last job :)
    Need Java help? Want to help people who do? Sit down with a cup of Java at the hotjoe forums.
    Sure they're new - come get them started!

  • About deprecated API

    hello friends,
    A friends of mine gave me the code of his project. After running it in
    NetBeans 4.0, I get the following message:
    NewStudentEntry.java uses or overrides a deprecated API.
    Note: Recompile with -Xlint:deprecation for details.
    Reason, that some of the methods have deprecated. How I could find these
    deprecated methods?
    thanks in advance
    anandScreen

    There must be a setting for compiler options somewhere in NetBeans.Indeed, there must. ;o)Hey, I don't use NetBeans. We have JBuilder, but it is way too slow (especially with the way our code works). 'vi' and command-line compilation/running on Unix is the way to go, anyway. I even just use jdb on the command line. It does the job.
    When we first got Windows on our home computer, I hated it. I was used to the DOS commands for copying and renaming files. File Manager (and now Explorer)? Who needs it?! ;-) I'd rather type than use the mouse, any day. Always felt like I had more control, and knew more what I was doing, with the full DOS commands than with Windows File Manager.

  • 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("");

  • 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?

  • Oracle 10.2 Loadjava for SQLJ says "..uses or overrides deprecated API"

    I just upgraded to 10.2 from 8.1.7 (platform is AIX 5L) and sqlj program was INVALID after upgrade.Running loadjava on the program seems successfull, and java class is VALID, but also get:
    Note: MQBridge uses or overrides a deprecated API.          
    Note: Recompile with -deprecation for details.
    Well, after lots of reading to try and assess the significance of the error and identify the deprecated API, I think the sqlj script on UNIX will allow me to issue the 'deprecated' option to perhaps identify the old API. However, the I'm having trouble even getting the sqlj to work (I think it's in $OH/oc4j/bin with non-executable permissions) and the README in $OH/sqlj/demo seems incorrect.
    The APIs in the program are:
    import oracle.sqlj.runtime.Oracle
    import java.sql.SQLException
    import oracle.sql.CLOB
    import com.ibm.mq.*
    import java.math.BigDecimal
    import java.util.*
    import javax.swing.event.*
    Perhaps someone versed in this arena can provide some guidance in what seems to be a straighforward problem (or maybe not a problem)? Sure would appreciate it!

    HI,
    In my opinion, upgrading the RDBMS might not suffices.
    I'd re-install SQLJ 10.2f rom the companion CD and check that its working fine in your environment using the following command:
    $ sqlj -version
    Oracle SQLJ Release 10.2.0.1.0 Production
    Copyright (c) 1997, 2005, Oracle Corporation. All Rights Reserved.Oracle furnishes the following code samples under
    $ORACLE_HOME/sqlj/demo/ to check your environment:
    connect.properties // to be customized to your environment
    TestInstallCreateTable.java
    TestInstallJDBC.java
    TestInstallSQLJ.sqlj
    TestInstallSQLJChecker.sqlj
    Then make sure that:
    - the executables (script and binaries) are available under $ORACLE_HOME/bin.
    - the PATH environment variable must include $ORACLE_HOME/bin.
    - the CLASSPATH environment variable must include the following:
    - the JDBC jars (ojdbc14.jar, or clases12.jar)
    - ORACLE_HOME/sqlj/lib/translator.jar
    - ORACLE_HOME/sqlj/lib/runtime12.jar
    As described in chapter 10 of my book, here is how to use them to check
    your environment:
    // create a table for test purposes
    $ javac TestInstallCreateTable.java
    $ java -Doracle.net.tns_admin=$TNS_ADMIN TestInstallCreateTable
    SALES table created
    $
    // Check JDBC install
    $ javac TestInstallJDBC.java
    $ java -Doracle.net.tns_admin=$TNS_ADMIN TestInstallJDBC
    Hello JDBC!
    $
    // Check the SQLJ translator, runtime, and the application
    $ sqlj TestInstallSQLJ.sqlj
    $ java -Doracle.net.tns_admin=$TNS_ADMIN TestInstallSQLJ
    Hello, SQLJ!
    $Then check that SQLJ is installed in the database using
    SQL> describe sys.sqljutlOtherwise, run the sqljutl.sql script to install it. In addition, the following query checks the availability of the SQLJ translator in the database (using system or a DBA account)
    SQL> select object_type, status from all_objects where
    2 dbms_java.longname(object_name) ='oracle/sqlj/checker/JdbcVersion';See chapter 10, 11 and 12 of my book for further coverage..
    Kuassi, http://db360.blogspot.com

  • Having problems linking two java classes getting a "deprecated API" error??

    Hi,
    I am tryin to link one page to another in my program, however i get the followin msg:-
    Project\alphaSound.java uses or overrides a deprecated API.
    Note: Recompile with -deprecation for details.
    Process completed.
    this only happens when i add the bold piece of code to the class; even though the italic piece of code does take you to a new page?:-
    public class alphaSound extends JPanel implements ActionListener
    {static JFrame f = new JFrame("AlphaSound");
    public alphaSound() {
    public void actionPerformed(ActionEvent event) {
                 Object source = event.getSource();
    else if(source == vowel)
    { Vowelm vm = new Vowelm();
    vm.setSize(Toolkit.getDefaultToolkit().getScreenSize());
    vm.show();
    f.dispose();
    else if(source == back)
    { MainPage main = new MainPage();
    main.setSize(400,300);
    main.show();
    f.dispose();}
    public static void main(String s[]) {
            WindowListener l = new WindowAdapter() {
                public void windowClosing(WindowEvent e) {System.exit(0);}
            //JFrame f = new JFrame("AlphaSound");
            f.addWindowListener(l);
            f.getContentPane().add(new alphaSound());
            f.setSize(Toolkit.getDefaultToolkit().getScreenSize()); 
            f.show();
    }here is the class its tryin to call
    public class Vowelm extends JPanel implements ActionListener
    {static JFrame v = new JFrame("VowelSound");
       public Vowelm() {
                                                   ..etc...
    public static void main(String s[]) {
            WindowListener l = new WindowAdapter() {
                public void windowClosing(WindowEvent e) {System.exit(0);}
            //JFrame f = new JFrame("VowelSound");
            v.addWindowListener(l);
            v.getContentPane().add(new VowelmSound());
            v.setSize(Toolkit.getDefaultToolkit().getScreenSize()); 
            v.show();
    }Im pretty sure ther is some conflict between the two classes due to the way they are called and designed?
    Hope you can help!
    Kind Regards
    Raj

    You may want to check your show() calls and see if
    they can be replaced with setVisible(). Forexample,
    in your Vowelm code, you have a static JFrame v.
    At
    the end of your main function, you use v.show().As
    of JDK1.1, this has been deprecated in favour of
    setVisible(boolean).hey show() in JFrame is from Window and in windowits
    not deprecated ..
    show is not decrecated thats for sure ... i dontknow
    y you said that ...
    you can look in docs as well..
    True - but this in turn overrides show() from
    java.awt.Component, which has been deprecated. My
    guess is that's where the problem comes from.
    Thanks for the Dukes!
    FlicAnd then again - perhaps not. After looking into this a bit more, I take back my last comment about the Component override. However, as I said in my original reply, compiling with -deprecation should tell you which show() call is flagging the error. There is definitely one somewhere that the JVM doesn't like - without seeing your complete code, it's hard to say exactly where. Based on what you've posted, my guess is that it is within the Vowelm class.
    Next time, I'll try to avoid 'shooting from the hip'.
    Again, thanks for the Dukes,
    Flic

Maybe you are looking for

  • Tables related to PM order for actual and commitment items

    Hello Experts, I need help in finding the tables related to PM order for actual and commitment items. I need develop a report which can show the actual and commitment items for each order and Operation/component under that each ITEM wise and its rela

  • How do i get my purchased adobe software loaded onto a new laptop

    how do i get my purchased adobe software loaded onto a new laptop

  • How to install new fonts using code in java?

    Hi, How to install font in a system using java, provided i know the font file's address. Is there any specific class/method available for this purpose? Copying the file to windows/font directory will work for windows, but I think it wont be generic t

  • Java Plug-In 1.4.1 Crashes in Win2000 IE6.0.2600

    Hallo Please can somebody help with information on why the Java Plug-in ver 1.4.1 just crashes when I try to run an applet under windows 2000 Professional using IE6.0.2600. Also I cannot run the Java Console nor the Java Plug-in Control panel, all of

  • Saving pdf's to ibook

    when i want to save pdf attachments to ibook directly, doesn't work. have to go to screen where it asks whether to save to ibook or kindle.  then i choose ibook and saves it there.  however, it does not SYNC to my ibook on my iphone - the pdf is not