Trying to use super class's methods from an anonymous inner class

Hi all,
I have one class with some methods, and a second class which inherits from the first. The second class contains a method which starts up a thread, which is an anonymous inner class. Inside this inner class, I want to call a method from my first class. How can I do this?
If I just call the method, it will use the second class's version of the method. However, if I use "super," it will try to find that method in the Thread class (it's own super class) and complain.
Any suggestions?
Code:
public class TopClass
     public void doSomething(){
          // do something
=============================
public class LowerClass extends TopClass
     // overrides TopClass's doSomething.
     public void doSomething(){
          // do something
     public void testThread(){
          Thread t = new Thread(){
               public void run(){
                    doSomething();               //fine
                    super.doSomething();          //WRONG: searches class Thread for doSomething...
          t.start();
}

Classes frequently call the un-overridden versions of methods from their superclasses. That's that the super keyword is for, if I'm not mistaken.You're not mistaken about the keyword, but you're not calling the superclass method from a subclass. Your anonymous inner class is not a subtype of TopLevel. It's a subtype of Thread.
Here it is no different, except that I happen to be in a thread at the time.It's vastly different, since you're attempting to call the method from an unrelated class; i.e., Thread.
I could also be in a button's action listener, for example. It seems natural to me that if I can do it in a method, I should be able to do it within an anonymous inner class which is inside a method.If you were in an button's action listener and needed to call a superclass' implementation of a method overridden in the button, I'd have the same questions about your design. It seems smelly to me.
~

Similar Messages

  • Need help!! How to use super in equals() method and makeCopy() method?

    This is my Name class:
    class Name {
        private String title;
        private String name;
        public Name(){
             title=" ";
             name=" ";
        public Name(String title){
             setTitle(title);
             name=" ";
        public Name(String title,String name){
             setTitle(title);
             setName(name);
        public void setTitle(String title){
             this.title=title;
        public String getTitle(){
             return title;
        public void setName(String name){
             this.name=name;
        public String getName(){
             return name;
        }   This is my Person Class
    class Person extends Name{
        private String address;
        private String tel;
        private String email;     
        public Person(){
             super();
             address=" ";
             tel=" ";
             email=" ";
        public Person(String name){
             super(name);
             address=" ";
             tel=" ";
             email=" ";
        public Person(String title,String name,String addressStr){
             super(title,name);
             setAddress(addressStr);
             tel=" ";
             email=" ";
        public Person(String title,String name,String addressStr,String phoneNum){
             super(title,name);
             setAddress(addressStr);
             setTel(phoneNum);
             email=" ";
        public Person(String title,String name,String addressStr,String phoneNum,String emailStr){
             super(title,name);
             setAddress(addressStr);
             setTel(phoneNum);
             setEmail(emailStr);
        public void setAddress(String add){
             address=add;
        public String getAddress(){
             return address;
        public void setTel(String telephone){
             tel=telephone;
        public String getTel(){
             return tel;
        public void setEmail(String emailAdd){
             email=emailAdd;
        public String getEmail(){
             return email;
         public boolean equals(Person inputRecords){
             boolean equalOrNot=false;
             if(inputRecords.super(getTitle()).equals(title))         //this is wrong
                  if(inputRecords.super(getName()).equals(name))           //this is wrong
                       if(inputRecords.getAddress().equals(address))
                            if(inputRecords.getTel().equals(tel))
                                 if(inputRecords.getEmail().equals(email))
                                      equalOrNot=true;
             return equalOrNot;   
            public void makeCopy(Person copyInto){
                 copyInto.super(setTitle(title));             //this is wrong
                 copyInto.super(setName(name));           //this is wrong
                 copyInto.setAddress(address);
                 copyInto.setTel(tel);
                 copyInto.setEmail(email);
    }How can I correct the wrong part?
    I don't understand how to use super in equals() method and makeCopy() method.

    Try something like this ...
    public boolean equals(Object other) {
      if (other==null || !(other instanceof Person)) return false;
      Person that = (Person) other;
      return getTitle().equals(that.getTitle())
          && getName().equals(that.getName())
          && getAddress().equals(that.getAddress())
          && getTel().equals(that.getTel())
          && getEmail().equals(that.getEmail())
    Notes:
    * This overrides Object's public boolean equals(Object other), which is (probably) what you meant.
    * You don't need to call "super.getWhatever" explicitly... just call "getWhatever" and let java workout where it's defined... this is better because if you then override getTitle() for example you don't need to change your equals method (which you would otherwise probably forget to do, which would probably have some interesting side effects.
    Cheers. Keith.

  • Trying to use FTP to get data from a different server

    Hi Friends,
        I have to use FTP to get data from a different server and upload it on SAP server. Now my problem is when I m trying to do ftp through command line it brings the file but with no data.
       Through ABAP program nothing is happening.
    Here's my code--
      V_PASSWORD = 'test@123'.
      V_PWD_LEN = STRLEN( V_PASSWORD ).
      CALL FUNCTION 'HTTP_SCRAMBLE'
        EXPORTING
          SOURCE      = V_PASSWORD
          SOURCELEN   = V_PWD_LEN
          KEY         = CS_KEY_500098
        IMPORTING
          DESTINATION = V_PASSWORD.
      CALL FUNCTION 'FTP_CONNECT'
        EXPORTING
          USER            = 'test'
          PASSWORD        = V_PASSWORD
          HOST            = '176.0.1.6'
          RFC_DESTINATION = 'SAPFTPA'
        IMPORTING
          HANDLE          = MI_HANDLE
        EXCEPTIONS
          NOT_CONNECTED   = 1
          OTHERS          = 2.
      CHECK SY-SUBRC = 0.
      cmd = 'lcd d:\ftp'. .
      PERFORM FTP_COMMAND USING CMD.
      CMD = 'asc'.
      PERFORM FTP_COMMAND USING CMD.
      CONCATENATE 'dir' 'ftpt*' INTO CMD SEPARATED BY SPACE.
      PERFORM FTP_COMMAND USING CMD.
      cmd = 'ls'.
    concatenate 'ls' INTO CMD SEPARATED BY SPACE.
      PERFORM FTP_COMMAND USING CMD.
      cmd = 'mget trial.txt'.
    CONCATENATE 'mget' 'trial.txt' INTO CMD SEPARATED BY SPACE.
      CALL FUNCTION 'FTP_COMMAND'
        EXPORTING
          HANDLE        = MI_HANDLE
          COMMAND       = CMD
        TABLES
          DATA          = MTAB_DATA1
        EXCEPTIONS
          TCPIP_ERROR   = 1
          COMMAND_ERROR = 2
          DATA_ERROR    = 3
          OTHERS        = 4.
      IF SY-SUBRC = 0.
        LOOP AT MTAB_DATA1.
          WRITE: / MTAB_DATA1.
        ENDLOOP.
      ELSE.
        CONCATENATE 'Error in FTP Command while executing' CMD INTO ERROR SEPARATED BY SPACE.
        WRITE: / ERROR.
      ENDIF.

    Hi
    try this.....in one of my reqt, i done this successfully....
    FORM FTPCON.
    FTP-------------------------------------------------------*
      CLEAR DSTLEN.
      SET EXTENDED CHECK OFF.
      DSTLEN = STRLEN( S_PWD ).     -
    >  (S_PWD (password) is a selection screen field )                  
      CALL FUNCTION 'HTTP_SCRAMBLE'
        EXPORTING
          SOURCE      = S_PWD
          SOURCELEN   = DSTLEN
          KEY         = KEY
        IMPORTING
          DESTINATION = S_PWD.
      CALL FUNCTION 'FTP_CONNECT'
        EXPORTING
          USER            = P_USER                   -
    > Username
          PASSWORD        = S_PWD             -
    > password
          HOST            = P_HOST                  -
    > Host
          RFC_DESTINATION = P_DEST         -
    > Destination
        IMPORTING
          HANDLE          = HDL
        EXCEPTIONS
          NOT_CONNECTED   = 1
          OTHERS          = 2.
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      CALL FUNCTION 'FTP_COMMAND'
        EXPORTING
          HANDLE        = HDL
          COMMAND       = 'set passive on'
        TABLES
          DATA          = RESULT
        EXCEPTIONS
          TCPIP_ERROR   = 1
          COMMAND_ERROR = 2
          DATA_ERROR    = 3.
      CALL FUNCTION 'FTP_R3_TO_SERVER'
        EXPORTING
          HANDLE         = HDL
          FNAME          = G_FCNAME
          CHARACTER_MODE = 'X'
        TABLES
          TEXT           = T_FILE1
        EXCEPTIONS
          TCPIP_ERROR    = 1
          COMMAND_ERROR  = 2
          DATA_ERROR     = 3
          OTHERS         = 4.
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      CALL FUNCTION 'FTP_R3_TO_SERVER'
        EXPORTING
          HANDLE         = HDL
          FNAME          = G_FCNAME1
          CHARACTER_MODE = 'X'
        TABLES
          TEXT           = T_FILE2
        EXCEPTIONS
          TCPIP_ERROR    = 1
          COMMAND_ERROR  = 2
          DATA_ERROR     = 3
          OTHERS         = 4.
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      CALL FUNCTION 'FTP_DISCONNECT'
        EXPORTING
          HANDLE = HDL.
      CALL FUNCTION 'RFC_CONNECTION_CLOSE'
          EXPORTING
            DESTINATION          = P_DEST
          EXCEPTIONS
            DESTINATION_NOT_OPEN = 1
            OTHERS               = 2.
        IF SY-SUBRC <> 0.
          MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                  WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
    ENDFORM.                    " FTPCON
    Hope it helps.....

  • Why do we use "super" for some methods?

    What I have noticed is that in some methods we have
    - (void)dealloc {
    [label release];
    [message release];
    [super dealloc];
    where at the end of the method we have [super dealloc]
    Why do we have that?

    The parent class may have allocated resources that you don't know about. Once you're finished deallocating resources in your object, you call the super-class' (parent-class') dealloc method to deallocate the things that it allocated. If you don't, whatever it allocated won't be deallocated.

  • AS3 air project.. nested button in a movie clip .. trying to use a class script

    I have been tring to have a button in a nested movie clip move the timeline along using a class script attached to the nested movie. I can get the buttons to work on the main timeline with another similar class script, but when I have a button within a nested movie and attach similar code to the movie, it doesn't seem to want to work. This is the class code attached to the nested clip.... I guess can an active listener be called if the button isn't yet being visible yet, and should this be done on the Main class script page for the main timeline? Any help would be great!! Thanks
    package  {
        import flash.display.MovieClip;
        import flash.events.MouseEvent;
        public class Animation extends MovieClip {
            public function Animation() {
                gotoAndStop(1);
                negBackground_btn.addEventListener(MouseEvent.MOUSE_UP, buttonPressedNegBackground);
            private function buttonPressedNegBackground(e:MouseEvent):void {
                negBackground_btn.visible = false;
                gotoAndStop("negChar");

    Hi,
    Your question is bit confusing, try to explain it. According to what I unsrestand you should use the particular movieClip name with the code to make it happen properly.
    Like :
    (movieClip_Instance).gotoAndStop("negChar");

  • Exception when trying to use web service login method

    Hi all,
    we've installed Discoverer, upgraded OAS to version 10.1.2 and installed the web service patch successfully. I can get the list of web service methods through
    http://app1.localdomain:7778/discoverer/wsi
    We've also created a bipublisher user in oiddas, and got it's guid. When I try to use the login method of the web services I get this exception:
    <?xml version='1.0' encoding='UTF-8'?>
    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <SOAP-ENV:Body>
    <SOAP-ENV:Fault>
    <faultcode>SOAP-ENV:Server.Exception:</faultcode>
    <faultstring>oracle.discoverer.applications.ws.util.DiscovererWSException: An error occurred during SSOUsername/GUID lookup.</faultstring>
    <faultactor>/discoverer/wsi</faultactor>
    </SOAP-ENV:Fault>
    </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>Does anyone have a clue what the problem is? I should also mention that after my DBA's advice we didn't upgrade the infrastructure instance, only the middle tier discoverer installation and then installed the repository upgrade.
    A few months back on a test installation I had tried to switch to SSO and then reverted back and managed to connect without SSO enabled.
    Edited by: dvm on Nov 11, 2008 7:22 AM

    Well... this is definitelly not a requirement.
    The code snippet came from the test (junit) for something which is much bigger. And of course the 1-char long table name has nothing to do with desing. At all.
    We have a system where a user defines (named) xml structures, so to say. The structures are then "translated" into DB entities. So the result DB schema is fully auto-generated. The system supports 4 different SQL dialects. Oracle is just one of them.
    Having restrictions like "name of a structure must be at least two characters" is no problem. But I still can`t believe Oracle has such a limitation. It does not sound logical (to me at least). And I had a hope may be someone has an explanation for that thing.
    The code above works just fine if I do not request certain columns back after the statement is executed. (e.g. without the second parameter).
    But anyway... I would post a bug for this, if I knew where to post it to :)
    Thanks.

  • Trying to use Migration Assistant to restore from Time Machine backup but it keeps "Looking for other computers..."

    Hi!
    I just bought a new MacBook Pro 15" and I wanted to transfer my old files from a previous Time Machine backup done with my old MacBook Pro 15".
    Both computers have Mac OS X 10.8.2 (Mountain Lion) installed.
    I always used Migration Assistant without any problem to accomplish this task, but now I don't know why it's stuck on a screen displaying "Looking for other computers...". What? What computer? I'm trying to restore from a Time Machine backup on an external hard drive, so I don't understand what computer it is looking for.
    Do you have any idea to solve the problem?
    Thanks!

    At the screen in Migration Assistant titled "Select a Migration Method," select From a Time Machine backup or other disk.
    How to use Migration Assistant to transfer files from another Mac

  • Using super class constructor in subclass constructor

    Hi all. How can I use Person() in my Client()?
    something like this:
    public class Client extends Person{
          private float balance;
          Client(String firstName,String midleName,String lastName,Contacts contacts,Adress adress,float balance){
               this= Person(firstName,midleName,lastName,contacts,adress);
               this.balance=balance;
          }

    public class Client extends Person{
      private float balance; // float?!? Are you sure.... ?
      Client(String firstName,String midleName,String lastName,Contacts contacts,Adress adress,float balance){
        super(firstName,midleName,lastName,contacts,adress);
        this.balance=balance;
    }

  • Trying to use the classes in casStubs.jar and get crawl metrics

    I was going through the class files available in casStubs.jar and was trying to come up with a script in AppConfig.xml to connect to the CAS server and obtain the crawl status and metrics. I was trying this option because the class com.endeca.eac.toolkit.component.cas.ContentAcquisitionServerComponent does not provide me these features.
    +<script id="CheckCrawlStatus">+
    +<bean-shell-script><![CDATA[+
    import javax.xml.namespace.QName;
    import com.endeca.cas.wsdl.*;
    final String wsdlUrl = "http://" "${cas.host}" + ":" + "${cas.port}" + "/cas?wsdl";+
    final QName name = new QName("http://endeca.com/itl/cas/2010-07", "CasCrawlerService");
    CasCrawlerServiceLocator service =  new CasCrawlerServiceLocator(wsdlUrl, name);
    CasCrawler crawler = service.getCasCrawlerPort();
    String crawlName = "myFirstCrawl";
    CrawlId crawlId = new CrawlId(crawlName);
    Metric[] metricArray = crawler.getMetrics(crawlId);
    + // rest of the code to retrieve crawl metrics +
    +]]></bean-shell-script>+
    +</script>+
    Unfortunately, I am always getting connection refused exception - "java.net.ConnectException: Connection refused". My cas wsdl is loading fine in my browser.
    Any ideas about the shortcomings in the code or missing configuration in CAS or DT or platformservices?
    Thanks
    Dev

    Hey Brett,
    Awesome, it works now. I went through the source code by de-compiling the class files and figured out why you referred to this extra line of code; great that it didn't miss your "laser eyes". It was really helpful.
    Another question for you; a stupid one maybe -
    I was also trying to call the web-services through the browser -
    http://{cas-host}:{cas-port}/cas/listCrawls - this one works great; gives me the list of all the crawls
    http://{cas-host}:{cas-port}/cas/getAllMetrics - this one work great too
    But when I try to pass a parameter my service call fails with an exception
    http://{cas-host}:{cas-port}/cas/getMetrics?crawlId={crawl-id}
    <soap:Body>
    <soap:Fault>
    <faultcode>soap:Server</faultcode>
    <faultstring>java.lang.ClassCastException@1b3bf979 while invoking public java.util.List com.endeca.itl.service.CasCrawlerImpl.getMetrics(com.endeca.itl.cas.api.CrawlId) throws com.endeca.itl.cas.api.CrawlNotFoundException with params {crawl-id}.</faultstring>
    </soap:Fault>
    </soap:Body>
    Note : {cas-host}, {cas-port} and {crawl-id} are placeholders for actual values.
    Any idea where I am going wrong?
    Thanks
    Dev
    Edited by: 950423 on Sep 4, 2012 3:13 PM

  • Using serialize and deserialize methods generated by clientgen

    I am trying to use the classes generated by the weblogic.webservice.clientgen tool
    from the weblogic 8.1 release. I would like to be able to make direct use of
    the serialize and
    deserialize methods in the "Codec" classes that correspond to the various request
    and
    response object classes. However, these methods require SerializationContext
    and
    deserializationContext objects as inputs. Are these context objects things I
    can construct,
    manufacture and/or access? Are there any coding examples for using these methods?
    Thanks.
    Michael

    Bruce,
    Thanks for the response. I have seen the documentation before. What that shows
    me is how
    to write customized Serialize and Deserialize methods. What I want to do is call
    the ones that
    clientgen has already created for me. I would love to have these called by the
    internals of the
    generated code as part of the handling of service calls. My problem is that the
    web site
    that I'm calling for these services uses SSL, and every attempt to use the clientgen-generated
    services results in the following exception being raised:
    javax.net.ssl.SSLKeyException: FATAL Alert:BAD_CERTIFICATE - A corrupt or unuseable
    certificate was received.
    Since I am successful in making SOAP calls to this same site -- certificate aren't
    an issue
    for these SOAP calls -- I thought that what I should try is to make the service
    calls myself
    using SOAP, but to use the generated Serialize and Deserialize methods
    to create the request body and process the response body surrounding the SOAP
    call.
    However, what I'd really like to do
    is figure out the cause of the SSLKeyException, and to make the service calls
    the way weblogic
    intended them to be made. So if you have any suggestions about what might
    be causing the exception, I'd appreciate the help.
    BTW. In addition to being able to make SOAP calls myself, I've also had some success
    making
    web service calls using code generated by Apache AXIS's wsdl2java tool and JWSDP's
    wscompile
    tool; however, neither of these wsdl processors are replacements for clientgen
    because they
    both have problems dealing with the complex structures described by wsdl files
    for the web
    services I'm trying to use.
    Bruce Stephens <[email protected]> wrote:
    Hi Michael,
    The De/SerializationContext are internal/private objects. The example
    in the doc (you have probably already seen) is a good starting point:
    http://e-docs.bea.com/wls/docs81/webserv/customdata.html#1052981
    Regards,
    Bruce
    BTW, Have you considered using XMLBeans?
    http://dev2dev.bea.com/technologies/xmlbeans/index.jsp
    Michael Horton wrote:
    I am trying to use the classes generated by the weblogic.webservice.clientgentool
    from the weblogic 8.1 release. I would like to be able to make directuse of
    the serialize and
    deserialize methods in the "Codec" classes that correspond to the variousrequest
    and
    response object classes. However, these methods require SerializationContext
    and
    deserializationContext objects as inputs. Are these context objectsthings I
    can construct,
    manufacture and/or access? Are there any coding examples for usingthese methods?
    Thanks.
    Michael

  • Regarding Super classes

    Hi,
    I have created one class in SE24. This class will be used as a super class for other classes.
    When subclasses are derived from this superclass, i want to make sure that some of the methods of superclasses are redefined by the subclasse compulsarily.
    So i want to force the subclasses to redefine complusarily some of the methods of its super class.
    Is this feasible. If so please let me know the corresponding approach.
    Thanks in advance !
    Pramod

    Hi,
    Check this out this will help you.
    Inheritance is the concept of passing the behavior of a class to another class.
    1.You can use an existing class to derive a new class.
    2.Derived class inherits the data and methods of a super class.
    3.However they can overwrite the methods existing methods and also add new once.
    4.Inheritance is to inherit the attributes and methods from a parent class.
    Inheritance:
    Inheritance is the process by which object of one class acquire the properties of another class.
    Advantage of this property is reusability.
    This means we can add additional features to an existing class with out modifying it.
    Go to SE38.
    Provide the program name.
    Provide the properties.
    Save it.
    Provide the logic for inheritance.
    *& Report  ZLOCALCLASS_VARIABLES                      *
    *&----------------------------------------------------*REPORT  ZLOCALCLASS_VARIABLES.
    *OOPS INHERITANCE
    *SUPER CLASS FUNCTIONALITY
    *DEFINE THE CLASS.
    CLASS CL_LC DEFINITION.
    PUBLIC SECTION.
    DATA: A TYPE I,
          B TYPE I,
          C TYPE I.
    METHODS: DISPLAY,
             MM1.
    CLASS-METHODS: MM2.
    ENDCLASS.
    *CLASS IMPLEMENTATION
    CLASS CL_LC IMPLEMENTATION.
    METHOD DISPLAY.
    WRITE:/ 'THIS IS SUPER CLASS' COLOR 7.
    ENDMETHOD.
    METHOD MM1.
    WRITE:/ 'THIS IS MM1 METHOD IN SUPER CLASS'.
    ENDMETHOD.
    METHOD MM2.
    WRITE:/ 'THIS IS THE STATIC METHOD' COLOR 2.
    WRITE:/ 'THIS IS MM2 METHOD IN SUPER CLASS' COLOR 2.
    ENDMETHOD.
    ENDCLASS.
    *SUB CLASS FUNCTIONALITY
    *CREATE THE CLASS.
    *INHERITING THE SUPER CLASS.
    CLASS CL_SUB DEFINITION INHERITING FROM CL_LC. "HOW WE CAN INHERIT
    PUBLIC SECTION.
    DATA: A1 TYPE I,
          B1 TYPE I,
          C1 TYPE I.
    METHODS: DISPLAY REDEFINITION,     "REDEFINE THE SUPER CLASS METHOD
             SUB.
    ENDCLASS.
    *CLASS IMPLEMENTATION.
    CLASS CL_SUB IMPLEMENTATION.
    METHOD DISPLAY.
    WRITE:/ 'THIS IS THE SUB CLASS OVERWRITE METHOD' COLOR 3.
    ENDMETHOD.
    METHOD SUB.
    WRITE:/ 'THIS IS THE SUB CLASS METHOD' COLOR 3.
    ENDMETHOD.
    ENDCLASS.
    *CREATE THE OBJECT FOR SUB CLASS.
    DATA: OBJ TYPE REF TO CL_SUB.
    START-OF-SELECTION.
    CREATE OBJECT OBJ.
    CALL METHOD OBJ->DISPLAY. "THIS IS SUB CLASS METHOD
    CALL METHOD OBJ->SUB.
    WRITE:/'THIS IS THE SUPER CLASS METHODS CALLED BY THE SUB CLASS OBJECT'COLOR 5.
    SKIP 1.
    CALL METHOD OBJ->MM1.     "THIS IS SUPER CLASS METHOD
    CALL METHOD OBJ->MM2.
    *CREATE THE OBJECT FOR SUPER CLASS.
    DATA: OBJ1 TYPE REF TO CL_LC.
    START-OF-SELECTION.
    CREATE OBJECT OBJ1.
    SKIP 3.
    WRITE:/ 'WE CAN CALL ONLY SUPER CLASS METHODS BY USING SUPER CLASS OBJECT' COLOR 5.
    CALL METHOD OBJ1->DISPLAY. "THIS IS SUPER CLASS METHOD
    CALL METHOD OBJ1->MM1.
    CALL METHOD OBJ1->MM2.
    This example will help you to solve your problem.
    For more detailed information GOTO -> SAPTECHNICAL ->Tutorials -> Object Oriented Programming.
    Regards Madhu.
    Code Formatted by: Alvaro Tejada Galindo on Jan 7, 2009 12:13 PM

  • Help for using java class in forms 9i

    hi
    i have been trying to use java class in forms9i but unable to execute ,i have encountered exceptions,for which exception handlers have been declared like ora_java.java_error and exception_thrown but failed to handle run time errors , i have tried all ways from my side.
    my java class returns a simple string
    i need help on various work arounds
    thanks in advance
    yash

    sir
    i have written a simple java class which returns a string hello imported using a java importer in forms 9i
    and i call my class in when button press trigger
    i have also imported java.lang.Exception for my exception handlers,i have no compile errors,but when i run my forms i get run time error and my exception handlers fail to trap it . ihave no idea how to proceed .
    should i use bean area in form and call the class using fbean from custom item rigger if so please explain
    can i get sample code example for calling a java class methods from forms.
    thanks
    yash

  • FTP using Runtime class ...Please Help ??

    Hi,
    I am trying to ftp a file programatically.
    I am trying to use Runtime class but facing problems
    in it.This is what I am trying to do :
    Runtime rr = Runtime.getRuntime();
    String[] cmds = new String[2];
    cmds[0]="username=rahmed";
    cmds[1]="password=prpas";
    try{
    Process p = rr.exec("ftp 192.168.1.18",cmds);     
    rr.exec("put vv.txt");
    This does not work ??
    Is there any way to make it work ? Or is there any
    other way to ftp a file programatically ??
    Thanks in adavance..
    Regards
    Rais

    Under Linux/Unix at least, it is good to use the switches -n and -i with the ftp client acually meant for intercative usage.
    -i Turns off interactive prompting during multiple file transfers.
    -n Restrains ftp from attempting ``auto-login'' upon initial connection.
    I do "user <myuser> <mypassword>" then from the script.
    I am happily using ftp this way from shell-scripts in my projects.
    scp is however better than ftp: it does not send plain text passwords over the net, it support key-based login, its encrypts the data.

  • Using bigdecimal class

    I was using Gregory-Leibniz series to calculate PI = 4 - 4/3 + 4/5 - 4/7 + 4/9 - 4/11 + ...
    Something like:
    double pi = 0.0;      
           int limit = 3000000;      
           for (int i = 0, y = 1; i <= limit; y+=2, i++)
                     if (y == 1)
                          pi = 4;
                   else if (i % 2 == 0)
                          pi += (double)4/y;            
                     else
                          pi -= (double)4/y;                                                   
                     System.out.println(String.format("Loop %d: %.20f", i, pi));                                    }Then I realized PI isn't going to be totally accurate according to IEEE Standard for Binary Floating-Point Arithmetic that java math calculation uses, so I was trying to use BigDecimal class (new to me), this is what I got initally...
             BigDecimal pi = new BigDecimal("0.00");           
              int limit = 3000000;
              for (int i = 0, y = 1; i <= limit; y += 2, i++)
                  if (y == 1)
                          pi = new BigDecimal("4.0");
                   else if (i % 2 == 0)
                          pi = pi.add(new BigDecimal( Double.toString( (double) 4 / y )));
                     else
                          pi = pi.subtract(new BigDecimal( Double.toString( (double) 4 / y )));
                        System.out.println(String.format("Loop %d: %s", i, pi.toString()));                                       
    I realize that when I do the 4/y calculations involving both doubles... the result is probably stored according to the IEEE standards which is the thing to avoid... Is that correct? Is my PI result going to be accurate?
    I noticed with this one decimals up to the 22nd place are all filled with some numbers in the calculations compared with the first one involving only double number calculations which had zero's starting around the 15th decimal.
    Something like doesn't work and ends up with arithmeticexceptions...
    pi = pi.subtract(new BigDecimal("4").divide(new BigDecimal(Integer.toString(y))));
    So I'm actually confused about the right way of using BigDecimal class in this type of calculation to get accurate results. I do realize it's an immutable class and probably a bad idea to use it like this 3 million times in a loop.

    quoting from the API documentation on BigDecimal
    "The BigDecimal class gives its user complete control over rounding behavior. If no rounding mode is specified and the exact result cannot be represented, an exception is thrown; otherwise, calculations can be carried out to a chosen precision and rounding mode by supplying an appropriate MathContext object to the operation."
    That explains the arithmetic exceptions.
    You would be advised to choose your scale first, (that would be the number of decimal places that you want to be using for your calculation. ) Then use the BigDecimal constructors that use the scale value. Construct your BigDecimal 4 outside of the loop so that you are not constructing it over and over again. And finally, read the documentation on how the scale of the result will depend upon the scale of the components going in.
    A little reading and possibly re-reading of the documentation will help in the understanding of the BigDecimal class.

  • Error trying to use jsp:useBean

              I am trying to use a class in a JSP that is basically a connection to an
              Oracle database. It works fine when used from a servlet. However, when I try
              to instantiate it from a JPS page, I get errors. Here is the snippet from
              the JSP page:
              <%@ page import="engr.projmgmt.*" %>
              <jsp:useBean id="OB" class="engr.projmgmt.OracleBroker" />
              The class is here:
              /usr/local/apache/servlets/engr/projmgmt/OracleBroker.class
              The weblogic class path contains /usr/local/apache/servlets.
              I get the following error in the weblogic log:
              Mon Aug 13 17:39:15 PDT 2001:<E> <ServletContext-General> Servlet failed
              with Exception
              java.lang.ClassNotFoundException: class engr.projmgmt.OracleBroker :
              java.lang.IllegalAccessException: engr/projmgmt/OracleBroker
              at java.beans.Beans.instantiate(Beans.java:215)
              at java.beans.Beans.instantiate(Beans.java:55)
              at jsp_servlet._PM._index._jspService(_index.java:90)
              at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
              at
              weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
              :120)
              at
              weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImp
              l.java:915)
              at
              weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImp
              l.java:879)
              at
              weblogic.servlet.internal.ServletContextManager.invokeServlet(ServletContext
              Manager.java:269)
              at
              weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP.java:365)
              at
              weblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java:253)
              at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:129)
              --------------- nested within: ------------------
              weblogic.utils.NestedRuntimeException: cannot instantiate
              'engr.projmgmt.OracleBroker' - with nested exception:
              [java.lang.ClassNotFoundException: class engr.projmgmt.OracleBroker :
              java.lang.IllegalAccessException: engr/projmgmt/OracleBroker]
              at jsp_servlet._PM._index._jspService(_index.java:92)
              at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
              at
              weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
              :120)
              at
              weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImp
              l.java:915)
              at
              weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImp
              l.java:879)
              at
              weblogic.servlet.internal.ServletContextManager.invokeServlet(ServletContext
              Manager.java:269)
              at
              weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP.java:365)
              at
              weblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java:253)
              at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:129)
              Anyone have anyideas?
              Thanks,
              CC
              

    I appears that your default constructor is not publicly accessible from the
              exception.
              Sam
              "Chuck Carson" <[email protected]> wrote in message
              news:[email protected]...
              >
              > I am trying to use a class in a JSP that is basically a connection to an
              > Oracle database. It works fine when used from a servlet. However, when I
              try
              > to instantiate it from a JPS page, I get errors. Here is the snippet from
              > the JSP page:
              >
              > <%@ page import="engr.projmgmt.*" %>
              > <jsp:useBean id="OB" class="engr.projmgmt.OracleBroker" />
              >
              > The class is here:
              > /usr/local/apache/servlets/engr/projmgmt/OracleBroker.class
              > The weblogic class path contains /usr/local/apache/servlets.
              >
              > I get the following error in the weblogic log:
              >
              > Mon Aug 13 17:39:15 PDT 2001:<E> <ServletContext-General> Servlet failed
              > with Exception
              > java.lang.ClassNotFoundException: class engr.projmgmt.OracleBroker :
              > java.lang.IllegalAccessException: engr/projmgmt/OracleBroker
              > at java.beans.Beans.instantiate(Beans.java:215)
              > at java.beans.Beans.instantiate(Beans.java:55)
              > at jsp_servlet._PM._index._jspService(_index.java:90)
              > at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
              > at
              >
              weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
              > :120)
              > at
              >
              weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImp
              > l.java:915)
              > at
              >
              weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImp
              > l.java:879)
              > at
              >
              weblogic.servlet.internal.ServletContextManager.invokeServlet(ServletContext
              > Manager.java:269)
              > at
              >
              weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP.java:365)
              > at
              > weblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java:253)
              > at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:129)
              > --------------- nested within: ------------------
              > weblogic.utils.NestedRuntimeException: cannot instantiate
              > 'engr.projmgmt.OracleBroker' - with nested exception:
              > [java.lang.ClassNotFoundException: class engr.projmgmt.OracleBroker :
              > java.lang.IllegalAccessException: engr/projmgmt/OracleBroker]
              > at jsp_servlet._PM._index._jspService(_index.java:92)
              > at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
              > at
              >
              weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
              > :120)
              > at
              >
              weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImp
              > l.java:915)
              > at
              >
              weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImp
              > l.java:879)
              > at
              >
              weblogic.servlet.internal.ServletContextManager.invokeServlet(ServletContext
              > Manager.java:269)
              > at
              >
              weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP.java:365)
              > at
              > weblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java:253)
              > at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:129)
              >
              >
              > Anyone have anyideas?
              >
              > Thanks,
              > CC
              >
              >
              

Maybe you are looking for

  • Error message for  Unable to connect (BIB-16633)

    Dear All I use Oracle Jdeveloper10g (win32), Oracle database10g or 9i (win32 ver). But Failure to connect to OLAP service. Can anyone give me what is the error message for BIB-16633. Would be really grateful if you could give me a solution as soon as

  • Printing to Photosmart printer via express

    I am trying to print photos from iphoto to our photosmart printer via our airport express. Everything works fine up to the point where the photo paper starts loading into the printer. Half way thru loading a message comes up on the printer that the p

  • Print sales order

    Hi Experts I have configured an output for sales order. When I go to VA03 -> Sales document -> Issue Output To I can see the printout in print preview, but when I click "print", no printout is generated even though I got a message "Output was success

  • Use module configuration location

    Hi, i tried in the configuration of a sql loader mapping the "Use module configuration location" option for the location of the control file. The problem is that i can select that value but it's not possibile to check. I can only select a location fr

  • Videos but no music

    I used to have no problem with my music videos playing music. Now all of a sudden, my videos still play but there is no music. This is the case on the IPOD and when playing in I-tunes on my computer. My regular songs play fine, but when it gets to a