How to find the arguments of a static method from the class file

Hi,all !
How to find the arguments of a static method from the class file? for example, when we meet a bytecode "invokestatic", how can I know the arguments of this static method?

Hi,all !
How to find the arguments of a static method from the
class file? for example, when we meet a bytecode
"invokestatic", how can I know the arguments of this
static method?You mean
1. The values?
2. Argument names?
3. Argument signatures.
I would suppose for the last that the easiest way would be to parse the signature string.
The first is not possible - not from the class file.
The second is only in the debug information stored in the optional part of the class file. And figuring out the format for that is going to be a problem.

Similar Messages

  • Calling a static method from another class

    public class Command
        public static void sortCommands(String command, String order, List object)
             if(command.equalsIgnoreCase("merge") && order == "a")
                  object.setAscending(true);
                  Mergesort.mergesort(object.list);                  // line 85
    }and
    public class Mergesort
         public static void mergesort (int[] a)
              mergesort(a, 0, a.length-1);
         private static void mergesort (int[] a, int l, int r)
         private static void merge (int[] a, int l, int m, int r)
    }Error:
    Command.java:85: cannot find symbol
    symbol : variable Mergesort
    location: class Command
    Mergesort.mergesort(object.list)
    What am I doing wrong here? Within the Command class I am calling mergesort(), a static method, from a static method. I use the dot operator + object so that the compiler would recognize the 'list' array. I tried using the
    Mergesort.mergesort(object.list);notation in hopes that it would work like this:
    Class.staticMethod(parameters);but either I am mistaken, misunderstood the documentation or both. Mergesort is not a variable. Any help would be appreciated, I have been hitting a brick wall for hours with Java documentation. Thanks all.

    [Javapedia: Classpath|http://wiki.java.net/bin/view/Javapedia/ClassPath]
    [How Classes are Found|http://java.sun.com/j2se/1.5.0/docs/tooldocs/findingclasses.html]
    [Setting the class path (Windows)|http://java.sun.com/j2se/1.5.0/docs/tooldocs/windows/classpath.html]
    [Setting the class path (Solaris/Linux)|http://java.sun.com/j2se/1.5.0/docs/tooldocs/solaris/classpath.html]
    [Understanding the Java ClassLoader|http://www-106.ibm.com/developerworks/edu/j-dw-javaclass-i.html]
    java -cp .;<any other directories or jars> YourClassNameYou get a NoClassDefFoundError message because the JVM (Java Virtual Machine) can't find your class. The way to remedy this is to ensure that your class is included in the classpath. The example assumes that you are in the same directory as the class you're trying to run.
    javac -classpath .;<any additional jar files or directories> YourClassName.javaYou get a "cannot resolve symbol" message because the compiler can't find your class. The way to remedy this is to ensure that your class is included in the classpath. The example assumes that you are in the same directory as the class you're trying to run.

  • Calling a non-static method from another Class

    Hello forum experts:
    Please excuse me for my poor Java vocabulary. I am a newbie and requesting for help. So please bear with me! I am listing below the program flow to enable the experts understand the problem and guide me towards a solution.
    1. ClassA instantiates ClassB to create an object instance, say ObjB1 that
        populates a JTable.
    2. User selects a row in the table and then clicks a button on the icon toolbar
        which is part of UIMenu class.
    3. This user action is to invoke a method UpdateDatabase() of object ObjB1. Now I want to call this method from UIMenu class.
    (a). I could create a new instance ObjB2 of ClassB and call UpdateDatabase(),
                                      == OR ==
    (b). I could declare UpdateDatabase() as static and call this method without
         creating a new instance of ClassB.With option (a), I will be looking at two different object instances.The UpdateDatabase() method manipulates
    object specific data.
    With option (b), if I declare the method as static, the variables used in the method would also have to be static.
    The variables, in which case, would not be object specific.
    Is there a way or technique in Java that will allow me to reference the UpdateDatabase() method of the existing
    object ObjB1 without requiring me to use static variables? In other words, call non-static methods in a static
    way?
    Any ideas or thoughts will be of tremendous help. Thanks in advance.

    Hello Forum:
    Danny_From_Tower, Encephalatic: Thank you both for your responses.
    Here is what I have done so far. I have a button called "btnAccept" created in the class MyMenu.
    and declared as public.
    public class MyMenu {
        public JButton btnAccept;
         //Constructor
         public MyMenu()     {
              btnAccept = new JButton("Accept");
    }     I instantiate an object for MyMenu class in the main application class MyApp.
    public class MyApp {
         private     MyMenu menu;
         //Constructor     
         public MyApp(){
              menu = new MyMenu();     
         public void openOrder(){
               MyGUI MyIntFrame = new MyGUI(menu.btnAccept);          
    }I pass this button all the way down to the class detail02. Now I want to set up a listener for this
    button in the class detail02. I am not able to do this.
    public class MyGUI {
         private JButton acceptButton;
         private detail02 dtl1 = new detail02(acceptButton);
         //Constructor
         public AppGUI(JButton iButton){
         acceptButton = iButton;
    public class detail02{
        private JButton acceptButton;
        //Constructor
        public detail02(JButton iButton){
          acceptButton = iButton;
          acceptButton.addActionListener(new acceptListener());               
       //method
        private void acceptListener_actionPerformed(ActionEvent e){
           System.out.println("Menu item [" + e.getActionCommand(  ) + "] was pressed.");
        class acceptListener implements ActionListener {       
            public void actionPerformed(ActionEvent e) {
                   acceptListener_actionPerformed(e);
    }  I am not able to get the button Listener to work. I get NullPointerException at this line
              acceptButton.addActionListener(new acceptListener());in the class detail02.
    Is this the right way? Or is there a better way of accomplishing my objective?
    Please help. Your inputs are precious! Thank you very much for your time!

  • I am not able access static methods from startup class

    I have a simple java class which queries the Database and holds some data. I am trying to access a static method of this class from the StartupClass and I am not able to do so. But I am able to access a static variable of the same class.
    Can someone help me here.

    Well, welcome to the world of "hacked" phones. If your purchase was from the US, you obviously purchased an iPhone that is locked to a US carrier. The iPhone must have been jailbroken and unlocked via software to accommodate your foreign SIM card. Now that you have updated the phone, it is locked back to the US carrier. Only the carrier can authorize Apple to unlock the iPhone and none of the US carriers will unlock the iPhones. Best suggestion is to sell the phone and obtain a factory unlocked version directly from the Apple store.
    To answer your other question, there is not a supported method to downgrade iOS.

  • Compilation error while calling static method from another class

    Hi,
    I am new to Java Programming. I have written two class files Dummy1 and Dummy2.java in the same package Test.
    In Dummy1.java I have declared a static final variable and a static method as you can see it below.
    package Test;
    import java.io.*;
    public class Dummy1
    public static final int var1= 10;
    public static int varDisp(int var2)
    return(var1+var2);
    This is program is compiling fine.
    I have called the static method varDisp from the class Dummy2 and it is as follows
    package Test;
    import java.io.*;
    public class Dummy2
    public int var3=15;
    public int test=0;
    test+=Dummy1.varDisp(var3);
    and when i compile Dummy2.java, there is a compilation error <identifier > expected.
    Please help me in this program.

    public class Dummy2
    public int var3=15;
    public int test=0;
    test+=Dummy1.varDisp(var3);
    }test+=Dummy1.varDisplay(var3);
    must be in a method, it cannot just be out somewhere in the class!

  • How to call a static method in a class if I have just the object?

    Hello. I have an abstract class A where I have a static method blah(). I have 2 classes that extend class A called B and C. In both classes I override method blah(). I have an array with objects of type B and C.
    For every instance object of the array, I'm trying to call the static method in the corresponding class. For objects of type B I want to call blah() method in B class and for objects of type C I want to call blah() method in C class. I know it's possible to call a static method with the name of the object, too, but for some reason (?) it calls blah() method in class A if I try this.
    So my question is: how do I code this? I guess I need to cast to the class name and then call the method with the class name, but I couldn't do it. I tried to use getClass() method to get the class name and it works, but I didn't know what to do from here...
    So any help would be appreciated. Thank you.

    As somebody already said, to get the behavior you
    want, make the methods non-static.You all asked me why I need that method to be
    static... I'm not surprised to hear this question
    because I asked all my friends before posting here,
    and all of them asked me this... It's because some
    complicated reasons, I doubt it.
    the application I'm writing is
    quite big...Irrelevant.
    Umm... So what you're saying is there is no way to do
    this with that method being static? The behavior you describe cannot be obtained with only static methods in Java. You'd have to explicitly determine the class and then explicitly call the correct class' method.

  • HT1529 How to find another Apple ID is registered my Product the Serial number.

    How to find another Apple ID is registered my Product the Serial number.
    my Apple Product cannot register to my Apple ID.

    https://appleid.apple.com/cgi-bin/WebObjects/MyAppleId.woa/

  • How to find out each Cell having Data or Not in Excel File by Using WDJ

    Hi Friends,
    I have one doubt on WDJ.
    I have to Upload Excel File. Click on Upload Button in Excel file Data will move to One Bapi. This is I was done. But my Requirement is if any empty Cell in Excel That File not uploaded it display one error message Please upload Correct Excel File
    How to find out each Cell having Data or Not in Excel File by Using WDJ. Please tell me.
    By Using this Code I have Upload Excel File
    InputStream text = null;
         int temp = 0;
         //wdComponentAPI.getMessageManager().reportSuccess("filePath Vijay:::");
         try
                   File file = new File(wdContext.currentContextElement().getResource().getResourceName().toString());     
    FileOutputStream op = new FileOutputStream(file);
                   if (wdContext.currentContextElement().getResource()!= null)
                          text = wdContext.currentContextElement().getResource().read(false);
                             while((temp=text.read())!= -1)
                                  op.write(temp);
                                  op.flush();
                                  op.close();
                                  path = file.getAbsolutePath();
                                  //wdComponentAPI.getMessageManager().reportSuccess("Path Name :::::"+path);
         catch(Exception ex)               
                   ex.printStackTrace();
    But my Requirement is If excel having any Empty Cell that excel file not uploaded.How to do this...
    Regards
    Vijay Kalluri

    Hi my friend
    I would like to share you some APACHE APi´s that i use when i have to read excel files in Web Dynpro.
    JAR = poi-3.2-FINAL-20081019.jar
    Some Example:
    POIFSFileSystem fs;
    HSSFWorkbook wb;
    HSSFSheet sheet;
    String myMexican_ValueFromExcelis = "";
    try {
             fs = new POIFSFileSystem(new FileInputStream();
             // and select the cell "y"
            cell = row.getCell( 0 );
            myMexican_ValueFromExcelis = cell.getCellValue();  
    }cach(Exception e){
    REgargds

  • How to install and use a plug-in downloaded from the apple site?

    how to install and use a plug-in downloaded from the apple site?

    Emelie,
    which plug-in do you want to install?
    some of the plug-ins come with an installer on the disk image, you click the installer and it will install it in its proper location.
    For others you move the plug-in into to System Library or your User Library:
      Your Hard disk  > Library > Application Support >Aperture > Plug-Ins > Edit
    or
    Your Home Folder > Library > Application Support >Aperture > Plug-Ins > Edit
    If it is an "Edit" plug-in, it goes into the "Edit" subfolder, "Export" plug-ins into the "Export" subfolder.
    You can tell by the extension, what kind of plug-in it is.
    E.G. BorderFX.ApertureExport is an export plug-in, BorderFXEditPlugin.ApertureEdit an edit plug-in.
    Regards
    Léonie
    P.S. In OS Lion the Libraries are hidden by default: To reveal your User Library activate the Finder and select from the main Finder menu:
        Finder >  Go , then hold down the ⌥-option-key, untill the Library appears in the drop.down menu.
    To show the System Library:
         Finder >  Go > Go to Folder
    then enter   / Library

  • TS3376 how do i take my phone off lock mode from the lost and track

    how do i take my phone off lock mode from the lost and track

    What To Do If Your iDevice or Computer Is Lost Or Stolen
    If your Mac, iPhone, iPod, iPod Touch, or iPad is lost or stolen what do you do? There are things you should do in advance - before you lose it or it's stolen - and some things to do after the fact. Here are some suggestions:
      1. Reporting a lost or stolen Apple product
      2. Find my lost iPod Touch
      3. AT&T, Sprint, and Verizon can block stolen phones/tablets
      4. What-To-Do-When-Iphone-Is-Stolen
      5. Lost or Stolen iPhone? Here’s What to do
      6. 6 Ways to Track and Recover Your Lost/Stolen iPhone
      7. Find My iPhone
    It pays to be proactive by following the advice on using Find My Phone before you lose your device:
      1. Find My iPhone
      2. Setup your iDevice on MobileMe
      3. OS X Lion- About Find My Mac
      4. How To Set Up Free Find Your iPhone (Even on Unsupported Devices)
    Third-party solutions for computers:
      1. VUWER 1.5.4
      2. Sneaky ******* 0.2.0
      3. Undercover 4.7
      4. LoJack for Laptops Premium Mac
      5. STEM 2.1
      6. MacPhoneHome 3.5

  • How  to find tables in Lo that  were extracted from R/3 to BW?

    Hi Experts,
    pls tell me How  to find tables in Lo that  were extracted from R/3 to BW?
    Thanks in advance.
    Regards,
    Hari Reddy

    Hi
    Check the following thread,if the earlier link doesnt work..
    How to locate which R/3 table-field is mapped to BW
    cheers

  • Why is the static method in the superclass more specific?

    Why is the static method in the superclass more specific than the static method in the subclass? After all, int is a subtype of long, but Base is not a subtype of Sub.
    class Base {
        static void m(int i){ System.out.println("Base"); }
    class Sub extends Base {
        static void m(long l){ System.out.println("Sub"); }
    class Test {
        public static void main(String[] args) {
            int i = 10;
            Sub sub = new Sub();
            sub.m(i);
    }The first example compiles without error.
    Output: Base
    class Base {
        void m(int i){ System.out.println("Base"); }
    class Sub extends Base {
        void m(long l){ System.out.println("Sub"); }
    class Test {
        public static void main(String[] args) {
            int i = 10;
            Sub sub = new Sub();
            sub.m(i);
    }In the second example, both instance methods are applicable and accessible (JLS 15.12.2.1), but neither is more specific (JLS 12.2.2), so we get a compiler error as expected.
    : reference to m is ambiguous,
    both method m(int) in Base and method m(long) in Sub match
    sub.m(i);
    ^
    1 error
    Why don�t we get a compiler error for the static methods?

    Thank you for your ideas.
    ====
    OUNOS:
    I don't get Sylvia's response. This is about static methods, what are instances are needed for??Yes, the question is about static methods. I included the example with non-static methods for a comparison. According to JLS 15.12.2, both examples should cause a compiler error.
    And why you create a Sub object to call the method, and dont just call "Sub.m(..)"Yes, it would make more sense to call Sub.m(i). Let�s change it. Now, I ask the same question. Why is there no compiler error?
    ====
    DANPERKINS:
    The error in your logic stems from calling static methods on instances, as ounos pointed out. Solution: don't. You won't see any more ambiguities.A static member of a class may also be accessed via a reference to an object of that class. It is not an error. (The value of the reference can even be null.)
    Originally I was looking only at the case with non-static methods. Therefore, I used sub.m(i). Once I understood that case, I added the static modifiers. When posting my question, I wish I had also changed sub.m to Sub.m. Either way, according to JLS 15.12.2, a compiler error should occur due to ambiguous method invocation.
    ====
    SILVIAE:
    The question was not about finding an alternative approach that doesn't throw up an ambiguity. The question related to why, in the particular situations described, the ambiguity arises in only one of them.
    Yes.
    Proposing an alternative approach doesn't address the question.
    Yes.
    ====
    If anyone is really interested, here is some background to the question. Some people studying for a Sun Java certificate were investigating some subtleties of method invocations:
    http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=24&t=019182
    I remember seeing the non-static case discussed in this forum once before in a more practical context. jschell probably knows the link.

  • I have connected my time capsule to motorola SG6580 modem via ethernet.  I have a wireless network on the motorola and a wireless network from the time capsule.  I get duplicate IPs error messages sometimes. How do I fix?

    I have connected my time capsule to motorola SG6580 modem via ethernet.  I have a wireless network on the motorola and a wireless network from the time capsule.  I get duplicate IPs error messages (no connection) sometimes when trying to connect devices to the wireless network. How do I fix? Sometimes devices cannot connect to the network because of conflicting IPs.  I look on the Motorola and every device has a unique IP assigned but occasionally a device has taken the IP of another device.  I have been writing down all the devices and the IPs they have been using.  It happens more with PCs than Macs, ipads or iPhones.

    If the Time Capsule is set up correctly in bridge mode, then it is the responsibility of the Motorola modem/router to provide the correct IP address assignments for all devices on the network.
    Check to insure that the Time Capsule is correctly set up to operate in bridge mode as follows:
    On your Mac, open AirPort Utility
    Finder > Applications > Utilities > AirPort Utility
    Click on the Time Capsule icon, then click Edit in the smaller window that appears
    Click the Network tab at the top of the next window
    Insure that the setting for Router Mode is configured to read "Off (Bridge Mode)"
    Once you have confirmed that the Time Capsule is configured correctly, everything else is the responsibility of the Motorola modem/router as far as network routing and IP address assignments for devices.
    If you continue to have IP address issues, then you should contact the Internet Service Provider (ISP) that provided the Motorola device to you and ask them to fix the issue.

  • How to find face time in iPhone 5 bought from Dubai

    How to find face time in iPhone 5 bought from Dubai

    Read the fine print at the bottom.
    Some features may not be available for all countries or all areas. Click here to see complete list.
    And the note for UAE on this page: http://support.apple.com/kb/ht1937
    FaceTime is not available in this country.

  • How to create a program that accepts 5 digits from the user between 0 and 9

    how to create a program that accepts 5 digits from the user between 0 and 9 then put them in ascending order using link-list method..

    You can use a scanner to get user input from the command line.
    import java.util.*;
    public class Test {
        private List<Integer> list;
        private Scanner in;
        public static void main (String... args) {
            new Test ();
        public Test () {
            list = new LinkedList<Integer> ();
            in = new Scanner (System.in);
            for (int i = 0; i < 5; i ++) {
                System.out.format ("Please enter a number (%d more): ", (5 - i));
                list.add (in.nextInt ());
            Collections.sort(list, new Comparator<Integer> () {
                public int compare (Integer i1, Integer i2) {
                    return i2 - i1;
            System.out.println (list);
    }

Maybe you are looking for

  • CUCM 8.6.2 - IP Phone 7940/7960 don´t change the time when finish DST

    Hi Guys, My Customer is having the problem about DST (date summer time) specifically about IP Phone 7940 and 7960. When finish the date summer time this model don´t change the time, only after restart logical or phisical. I simulated the problem in t

  • Time Machine migration problems

    Hello! I've just bought a new 15" MacBook Pro, to replace my 13" MacBook Pro as I needed a bigger screen. However, I'm having a lot of difficulty transferring my files across from a Time Machine backup I have of my old computer (and now it's the only

  • ISQLplus not working

    Hi forum, isqlplusctl start : okay. http://<servername>:5560/iSQLplus doesn't work. Is there any need to make an entry into /etc/services or tnsnames.ora or listener.ora ? Or must iSQLplus be installed separately ? http://<servername>:5560 works and

  • Why do u inhabit truecaller from showing non saved contacts as other operating systems

    I have a truecaller app but it don't show names for unsaved no. When they calls as I was used in Samsung for example and when I asked the apps co. They told me that apple don't allow them to do..so please could u guys manage this

  • Question about accesing binary data

    If I have a text file saved on my harddrive, how is it really stored? Can I access the raw binary data of the text file?