Time estimation of a class file without execution

Can any body help me....
I have to find the execution time of class files without execution.
can I do it with java...!!!!!!!!!!

Presumably this is a class assignment and not a work assignment. If it is for work then either ask for justification for this stupidity or start playing games and looking for another job.
Use javap and count the byte codes. Each byte code has a size so give a execution time of n X size. Each branch has a execution time of n X size + 1 (since it take longer.) Each method call is n X size + 2 (a goto and a return.)
'n' in the above is an arbritrary constant.
Each method is the sum of its contents. If you have a loop that calls a method you have to estimate the average loops and use that multiplied by the method count.
For system methods you will just have to list them and give each a unknown time, since presumably you aren't analyzing everything.

Similar Messages

  • Getting Package Name From Class File Without Parsing File

    I am writing an application where I need to get the package name from a class file without parsing the class file itself.
    Basically, what happens is the user chooses a class file from anywhere in the file system. I then want to use reflection to get information about that class. To do that I need the fully qualified class name. I know that the package name is part or all of the path name but I don't know for sure which part it is. I don't want to parse the class file directly for the package name in case the class file spec is changed (that way I won't have to rewrite any code).
    Does Java have any way of getting this information without doing something stupid like gradually stripping off part of the pathname and trying it?

    The ClassLoader way seems to work fine, copy a class file to "A.class" and run this:import java.io.*;
    class ClassLoaderExample {
        public static void main(String[] args) throws Exception {
            class MyClassLoader extends ClassLoader {
                public Class load() throws IOException {
                    File f = new File("A.class");
                    byte[] classData = new byte[(int) f.length()];
                    new RandomAccessFile(f, "r").readFully(classData);
                    Class loaded = defineClass(null, classData, 0, classData.length);
                    resolveClass(loaded);
                    return loaded;
            Class c = new MyClassLoader().load();
            System.out.println(c);
            System.out.println(c.newInstance());
    }

  • Business Objects Customization Using Class file without net bean

    Hi,
    Any one please help me out.
    my requirement is like I want to use Business Objects SDK
    <%@ page import="com.crystaldecisions.sdk.framework.CrystalEnterprise" %>
    above is example..
    in Class file of Java without using netbean.
    I try to do this with creating Batch file add all Jar file and set path and but its not working.
    Also can I Login Into business Objects through class file not using netbean(means from command prompt)
    and create user group into CMS.

    Please find following servlet code who dont understand my requirement.
    * GroupCreation.java
    * Created on September 2, 2008, 3:47 PM
    import java.io.*;
    import java.net.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import com.crystaldecisions.enterprise.ocaframework.ServiceNames;
    import com.crystaldecisions.sdk.exception.SDKException;
    import com.crystaldecisions.sdk.framework.CrystalEnterprise;
    import com.crystaldecisions.sdk.framework.IEnterpriseSession;
    import com.crystaldecisions.sdk.framework.ISessionMgr;
    import com.crystaldecisions.sdk.occa.infostore.IInfoStore;
    import com.crystaldecisions.sdk.occa.managedreports.*;
    import com.crystaldecisions.sdk.occa.security.ILogonTokenMgr;
    import javax.servlet.http.Cookie;
    import com.crystaldecisions.sdk.occa.infostore.*;
    import com.crystaldecisions.sdk.occa.pluginmgr.*;
    import com.crystaldecisions.sdk.plugin.CeProgID;
    import com.crystaldecisions.sdk.plugin.desktop.user.*;
    import com.crystaldecisions.sdk.properties.*;
    import javax.servlet.http.HttpSession;
    * @author prashant.joshi
    * @version
    public class GroupCreation extends HttpServlet
    protected void doPost(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException
    HttpSession session = request.getSession(true);
    response.setContentType("text/html;charset=UTF-8");
    PrintWriter out = response.getWriter();
    String cms = request.getParameter("CMS");
    String username = request.getParameter("UserID");
    String password = request.getParameter("Password");
    String auth = request.getParameter("Aut");
    IEnterpriseSession enterpriseSession = null;
    try
    ISessionMgr sessionMgr = CrystalEnterprise.getSessionMgr();
    catch(SDKException e)
    out.println(e.getMessage());
    Exception failure = null;
    boolean loggedIn = true;
         // If no session already exists, logon using the specified parameters.
    if (enterpriseSession == null)
    try
    // Attempt logon. Create an Enterprise session
    // manager object.
    ISessionMgr sm = CrystalEnterprise.getSessionMgr();
    // Log on to BusinessObjects Enterprise
    enterpriseSession = sm.logon(username, password, cms, auth);
    catch (Exception error)
    loggedIn = false;
    failure = error;
    if (!loggedIn)
    // If the login failed, redirect the user to the start page.
    out.println("<SCRIPT language=\"javascript\"> " +
    " alert (\"Sorry - you could not be logged on to this server." +
    " Ensure that your user name and password, as well as the CMS name are correct." +
    "\"); </SCRIPT>");
    out.println("<META HTTP-EQUIV='refresh' CONTENT='0;URL=LogonPage.jsp'>");
    return;
    else
    try
    // Store the IEnterpriseSession object in the session.
    session.setAttribute("EnterpriseSession", enterpriseSession);
    // Create the IInfoStore object.
    IInfoStore iStore = (IInfoStore) enterpriseSession.getService("InfoStore",
    ServiceNames.OCA_I_IINFO_STORE);
    // Store the IInfoStore object in the session using the
    // helper functions.
    session.setAttribute("InfoStore", iStore);
    // Create the IReportSourceFactory object.
    IReportSourceFactory reportSourceFactory = (IReportSourceFactory) enterpriseSession.getService("PSReportFactory");
    // Store the IReportSourceFactory object in the session
    // using the helper functions.
    session.setAttribute("ReportSourceFactory", reportSourceFactory);
    // Retrieve the logon token manager.
    ILogonTokenMgr logonTokenMgr = enterpriseSession.getLogonTokenMgr();
    // Retrieve a logon token and store it in the user's cookie
    // file for use later.
    Cookie cookie = new Cookie("LogonToken", logonTokenMgr.createLogonToken("", 60, 100));
    response.addCookie(cookie);
    // LOCUse the plugin manager and the UserGroup plugin to create a new
    // UserGroup object._ENDLOC_
    // LOCIf the infoStore object is not found then display an error message._ENDLOC_
    IInfoStore infoStore = (IInfoStore) session.getAttribute("InfoStore");
    // LOCIf the infoStore object is not found then display an error message._ENDLOC_
    if (infoStore == null)
    throw new Error("_LOC_InfoStore object not found. Please logon again._ENDLOC_");
    IPluginMgr pluginMgr = infoStore.getPluginMgr();
    //IPluginMgr pluginMgr2 = infoStore.getPluginMgr();
    IPluginInfo userGroupPlugin = pluginMgr.getPluginInfo("CrystalEnterprise.UserGroup");
    // IPluginInfo userGroupPlugin2 = pluginMgr.getPluginInfo("CrystalEnterprise.UserGroup");
    // LOCCreate a new InfoObjects collection._ENDLOC_
    IInfoObjects newInfoObjects1 = infoStore.newInfoObjectCollection();
    IInfoObjects newInfoObjects2 = infoStore.newInfoObjectCollection();
    // LOCAdd the UserGroup interface to the new InfoObjects collection._ENDLOC_
    newInfoObjects1.add(userGroupPlugin);
    newInfoObjects2.add(userGroupPlugin);
    // LOCGet the new UserGroup object from the collection._ENDLOC_
    IInfoObject iObject1 = (IInfoObject) newInfoObjects1.get(0);
    IInfoObject iObject2 = (IInfoObject) newInfoObjects2.get(0);
    // LOCOnce you have the new UserGroup object, set its properties._ENDLOC_
    iObject1.setTitle ("Single Home Group");
    iObject1.setDescription ("It is Single Home Group");
    iObject2.setTitle ("Multi home Group");
    iObject2.setDescription ("It is multi Home Group");
    // LOCRetrieve the ID of the InfoObject (user group)._ENDLOC_
    // objectID = iObject.getID();
    // LOCSave the new group to the CMS._ENDLOC_
    infoStore.commit (newInfoObjects1);
    infoStore.commit (newInfoObjects2);
    catch(Exception ex)
    // If the User group is already created.
    out.println("<SCRIPT language=\"javascript\"> " +
    " alert (\"Sorry - The User Group is already created Please enter another User Group." +
    "\");</SCRIPT>");
    out.println("<META HTTP-EQUIV='refresh' CONTENT='0;URL=LogonPage.jsp'>");
    return;
    // If the User is Logged on the Business objects
    out.println("<SCRIPT language=\"javascript\"> " +
    " alert (\"UserGroup get created in CMS.\"); </SCRIPT>");
    out.println("<META HTTP-EQUIV='refresh' CONTENT='0;URL=LogOff.jsp'>");
    out.close();
    /** Returns a short description of the servlet.
    public String getServletInfo() {
    return "Short description";
    // </editor-fold>
    when I paste above code in simple notepad as class file and run this file from command prompt
    it gives error like following 1 example I getting 46 errors for different Business Objects classes
    symbol : variable CrystalEnterprise
    location: class GroupCreation
    ISessionMgr sm = CrystalEnterprise.getSessionMgr();
    Please help me Out.
    Thank you.

  • Can you execute a class file without invoking the command line java command

    I am running java on a Windows XP equipped machine, and I am wondering if it is possible to execute a class file by double clicking the file icon, or can it only be done via command line. So far I have been unsuccessful in my attempts - I tried associating the class file with the java executable in my JRE directory, but that didn't work.
    Many thanks,
    -Stile

    nope, can't be done, by design... microsoft recognised java as threat to the empire very early on in the peace.... but you can write a batch file to execute myprogram.class called myprogram.bat and stick it in your PATH.
    keith.

  • Updated Class files not generated

    Hi ,
    I am using Eclipse SDK Version: 3.2.2 and have configured with my project and weblogic server. When the application is running in debug mode if necessary making some fix and when i use ctrl+b the new class file should be generated and immediately the application should refer to the new class file without expecting to restart the weblogic server.
    But that's not happening, when i do a ctrl+b the class files are cleaned and new class files are not getting generated,moreover this cleaning is also consuming lot of time.
    Can some body help me to resolve this , so that i can save lot of time in restarting the server for every small fix too.
    Regards
    Sathya

    Hi ,
    I am using Eclipse SDK Version: 3.2.2 and have configured with my project and weblogic server. When the application is running in debug mode if necessary making some fix and when i use ctrl+b the new class file should be generated and immediately the application should refer to the new class file without expecting to restart the weblogic server.
    But that's not happening, when i do a ctrl+b the class files are cleaned and new class files are not getting generated,moreover this cleaning is also consuming lot of time.
    Can some body help me to resolve this , so that i can save lot of time in restarting the server for every small fix too.
    Regards
    Sathya

  • Execute Class file

    Is is possible execute the class file without the intepreter?
    If can , how to do?
    Can I convert the class file to exe file ?

    Is is possible execute the class file without the
    intepreter?No, only if you run on a platform that understands the java bytecodes without an interpreter.
    Can I convert the class file to exe file ?Yes, search for java exe(cutable) in the forum or the web. You need a program to do this conversion, but then your program will only run on windows.

  • Running Class file

    Hello,
    I am a beginner.
    I got a problem which is every time I run a class file after compiling *.java. I have to type the whole path
    java -classpath C: (foldername) (filename)
    to run the program.
    It is suppose to be no problem once I can run the command "javac" successfully. Now everytime I have to type
    javac (filename)
    Also the setting still got something wrong which it cannot generate the path to /Lib/tools.jar as well
    Could anyone help me on this?
    Thank you very much
    My operating system is Window 98 SE
    Here is my autoexec.bat setting:
    SET PATH=c:\windows;c:\windows\COMMAND;C:\PROGRA~1\SYMANTEC\PCANYW~1
    @SET CLASSPATH=C:\PROGRA~1\PHOTOD~1\ADOBEC~1
    SET PATH=%PATH%;C:\PROGRA~1\COMMON~1\AUTODE~1
    SET PATH=%PATH%;c:\PROGRA~1\COMMON~1\AUTODE~1
    PATH C:\WINDOWS;C:\WINDOWS\COMMAND
    SET PATH=%PATH%;C:\JAVA\BIN
    set CLASSPATH=.:C:\JAVA\lib\tools.jar
    PATH c:\windows;c:\windows\COMMAND;C:\WINDOWS/DESKTOP
    SET CLASSPATH=C:\WINDOWS\COMMAND;C:\WINDOWS/DESKTOP

    Your batch file overrides the value of CLASSPATH several times. Try putting the paths of everything you require into the last instance of the "SET CLASSPATH" line and then eliminate all other instances of it for purposes of readability.
    By the way, this kind of question should probably not be posted in the "Java Virtual Machine" forum. No offense, but the "New to Java Technology" forum would be more appropriate.

  • How to enable a custom web part class file to be refreshed at regular interval of time, without affecting the entire page where its placed.

    Hi,
    I am calling a web service in the web part class file where it gets the data. I need to call the service at regular intervals of time which is in the web part, is there a way to get the web part refreshed automatically at certain intervals of time.
    Rayudu

    You can use Ajax for automatic refreshing.
    Add a timer control into an Ajax Update panel within your custom web part and execute your code to refresh the field values within the Timer_Tick() event.
    You can also control the timer interval to 10 minutes or so using the Timer.Interval property.
    This will always enable your page to remain with only the web parts getting refreshed.
    I just found
    a blog post which describes this in detail with screenshots.

  • How to write in a file without erase it each time I want to write inside

    Hi
    My problem is to write in a unique file without erasing what I have written inside before.
    Because I use an Applet and I write some information in afile each time the user push a button but I want to keep all the information, beacause in my case I only have the last information i.e. the last time the user push the button.
    My code is:
    Below it is the code where I write in the file:
    writer2 = new BufferWriter("chemin.txt");
    methode = uneMethode;
    eps = unEps;
    n = unN;
    solExacte=uneSolExacte;
    y=z;
    Date time =new Date();
    Vector valeur = new Vector();
    valeur.add(new Double(eps));
    valeur.add(new Integer(n));
    valeur.add(new Integer(solExacte));
    valeur.add(new Integer(methode));
    String time_string = time.toString();
    valeur.add(new String(time_string));
    //writing to variables file
    BufferWriter writer = new BufferWriter("variables");
    writer.write(valeur);
    Now it is the class Bufferwriter:
    import java.io.BufferedWriter;
    import java.io.FileWriter;
    import java.io.IOException;
    import java.util.Vector;
    import java.io.File;
    public class BufferWriter {
    private String fileName;
    BufferedWriter w;
    public BufferWriter(String name) throws IOException {
    fileName=name;
    w=new BufferedWriter(new FileWriter(new File(fileName)));
    public void write(Vector v) throws IOException {
    String string;
    for (int i=0; i<5; i++) {
    string=((v.get(i)).toString());
    w.write(string,0, string.length());
    w.newLine();
    w.flush();
    public void close() throws IOException{
    close();}

    try
    w=new BufferedWriter(new FileWriter(fileName, true));
    The Constructor you want is ..
    FileWriter
    public FileWriter(String fileName,
    boolean append)
    throws IOException

  • How to call a class file in a jsp without deploying anything in j2ee

    Hi,
    I am new in J2EE. I have some jsps, which I configured using web.properties(documentroot=c:/jsp/). I am able to get
    those pages by the web browser. I have some import statements in some jsps, now I
    am trying to access those page but it is failing, it says
    org.apache.jasper.JasperException: Unable to compile class for
    JSPD:\j2sdkee1.3\repository\pradip\web\_0002fLogin_0002ejspLogin_jsp_0.java:1:
    Class com.gui.UPMGuiGlobalConstants not found in import.
    import com.gui.UPMGuiGlobalConstants;
    Actually I have not deployed any class file or jsps.. Now my question is can I access
    these jsps without deploying anything, like can I put my .jar file in any j2ee
    directory(like lib or anywhere else, I already tried after putting in /lib) and restart the
    j2ee and use it. So how can I call a class file from a jsp without any kind of
    deployment?
    Please send me the reply as soon as possible.
    Regds,
    Pradip

    After you put the jar containing the class to import into the WEB-INF/lib directory, you still need to include it in the jsp.
    Putting the jar into the lib dir, will make it available to the vm, but as in any other java class, you still need to import it into the class, that the jsp will be compiled into.
    And you do that by putting
    <%@page import="com.gui.UPMGuiGlobalConstants" %>somewhere near the top of your jsp. (well you don't need to put it there, but it good style ;)
    That should do it.

  • How to convert java class file version without decompiling

    Hi,
    Oracle R12.1.3 i am having illegal access error while try to access the class file version Java 1.3 uses major version 47,So how to convert the class file version without using decompiling.
    Current java version is 1.6.0_07
    Is there any tool or API for converting class file version?
    Thanks,
    Selvapandian T

    Beside this I wonder where you get your error from since AFAIK 12c comes with java 1.6.
    Well wonder no more!
    OP isn't using Oracle 12c database.
    They are using Oracle R12.1.3 - which is the E- Business Suite.

  • How to convert a .class file into .java file without .jad using DeJDecompil

    Hi all,
    I am using DeJDecompiler and working with swing applications.If I try to convert a .class file into .java file,it is converting into .jad file only.Fine but if I try to save that file into .java file,It is giving lot of errors in that program.When I went into that program the total style of the program is changed and TRY-CATCH block is not recognised by the dejdecompiler,hence If I try to include some methods in the existing .java file thus got,I could not do.Kindly help me.
    If I get the .java file without error then I can process the rest of the functionality.
    Thanks in advance
    With kind Regs
    Satheesh.K

    Not so urgent today then!
    http://forum.java.sun.com/thread.jsp?thread=553576&forum=31&message=2709757
    I'm still not going to help you to steal someone�s code.

  • How can I do to acquire and save date in the same time and in the same file when I run continual my VI without interrupti​on.

    I've attached a VI that I am using to acquire amplitude from Spectrum analyzerse. I tried to connect amplitude ouput to the VI Write Characters To File.vi and Write to Spreadsheet File.vi. Unfortunately when I run continual this VI without interruption, labview ask me many time to enter a new file name to save a new value.
    So, How can I do to aquire and save date in the same time and in the same file when I run continual my VI for example during 10 min.
    Thank you in advance.
    Regards,
    Attachments:
    HP8563E_Query_Amplitude.vi ‏37 KB

    Hi,
    Your VI does work perfectly. Unfortunately this not what I want to do. I've made error in my last comment. I am so sorry for this.
    So I explain to you again what I want to do exactly. I want to acquire amplitude along road by my vehicle. I want to use wheel signal coming from vehicle to measure distance along road. Then I acquire 1 amplitude each 60 inches from spectrum analyzer.
    I acquire from PC parallel port a coded wheel signal coming from vehicle (each period of the signal corresponds to 12 Inches). Figure attached shows the numeric signal coming from vehicle, and the corresponding values “120” and “88” that I can read from In Port vi.
    So I want to acquire 1 time amplitude from spectrum analyser each 5
    period of the signal that I am acquiring from parallel port.
    So fist I have to find how can I count the number of period from reading the values “120” and “88” that I am acquiring from In Port (I don’t know the way to count a number of period from reading values “120” and “88”).
    Here is a new algorithm.
    1) i=0 (counter: number of period)
    2) I read value from In Port
    3) If I acquire a period
    i= i+1 (another period)
    4) If i is multiple of 5 (If I read 5 period)
    acquire 1 time amplitude and write to the same
    file this amplitude and the corresponding distance
    Distance = 12*i). Remember each period of signal
    Corresponds to 12 Inches).i has to take these
    values: 5,10,15,20,25,35,40,45,50,55,60............
    5) Back to 2 if not stop.
    Thank you very much for helping me.
    Regards,
    Attachments:
    Acquire_Amplitude_00.vi ‏59 KB
    Figure_Algorithm.doc ‏26 KB

  • At the time of generating .class files i got below warning.

    Hi all,
    i develop one oaf page and move to server and generate .class files.
    at the time of generate .class files i got below error.
    plz help me.
    *[appldev@wnsfinapp webui]$ javac AgingBucketsCO.java -deprecation*
    AgingBucketsCO.java:114: warning: setRedirectURL(java.lang.String) in oracle.apps.fnd.framework.webui.OAPageContext has been deprecated
    pageContext.setRedirectURL(
    *^*
    *1 warning*
    Thanks
    Seshu
    Edited by: its urgent on Jan 30, 2012 4:47 AM

    Hi Pratap,
    thanks for your replay,
    i register the page in apps its working fine.
    but my page having go button.normally whenever goto the GO button it display hyperlink.
    in my local machine displays hyperlink.after move to server it displays cursor.
    Plz help me
    Thanks
    Seshu.

  • How to get info from a .class file at run time? thanks for help

    I need to get methods and properties (variables) from a .class file at run time.
    as u know, javap.exe can do that in an independent way. but i need to get info at run time once the .class or packeges have been changed, javap is not suitable in the case.
    i try to read data directly from .class file but it's hard to know the file format.
    e.g. a class looks like (java file):
    class MyClass extends Frame
    int i0;
    String s0;
    public String getName()
    if the file is compiled to .class file, how to get properties (variables: i0,s0) and methods String getName() from the .class file by an applicaton at run time?
    Doclet is not suitable for speed reason, it is too slow to get right info in right format.
    Thanks for any help, please write a little bit more in detail if you know.

    Use the Java Reflection API. Have a look at the Reflection section of the Java Tutorial located at http://java.sun.com/docs/books/tutorial/reflect/index.html

Maybe you are looking for

  • HOW TO LENGTHEN THE SHORT TEXT FIELD IN  PR-urgent

    dear friends, my client is asking to lengthen the field size of SHORT TEXT in purchase requisition. if they enter the long text, the characters are getting tranucated. can you please provide me good solution for this problem. who is handling this iss

  • Automator: Render PDF as Images changes the filename.

    I have a PDF named "Bamboo Cutting Board Sales Sheet.pdf" that contains one image. When I run the PDF through the Automator action Render PDF As Images, the filename is saved and changed to "002ddf334.jpg. How do I keep the original file name?

  • How to identify the presence of scroll bars in browser from the plug-in

    I am developing a plug-in for the type application/x-shockwave-flash. In windowless mode, firefox window client area shared by all the plug-ins. Since plug-in runs in plugincontainer.exe, and DC is passed from firefox.exe, i couldn't the any api or t

  • No space between buttons

    Hi, Here i put three buttons on panel one under one but there is no space between them although i determine the space .. my code : import java.awt.Color; import java.awt.Dimension; import javax.swing.BorderFactory; import javax.swing.JButton; import

  • Factory reset restoration in

    Hello .  while iam trying to reset my laptop to factory condition i always get restoration incomplete message like in this photo  details "  there is might be unexpected rebooting during BBV clean or last  the process will cause CTO panic becouse the