How to find the main java class file

I need to write a Java program which MUST know one of these:
1) the full path to the main java class (the class with "main" method)
or
2) access to the main class as byte array.
If i know (1) then I have no problems reading the main class into byte array, but the main target is still (2).
Another option is if the main file is in JAR, which again leads to problems, because I cannot access the file in normal way, but I still need access to the exact byte stream.
Any help is highly appreciated! Thanks!
<<< Ivan Davidov >>>

You could try somthing like this in your main-method:
InputStream is = getClass().getResourceAsStream(<"myModifiedPackageName/MyClass.class">);I don't know if this works though.
Have a look at the API doc for this method.
-Puce

Similar Messages

  • Where can i find the BI Java Connector Files (for example: bi_sdk_jdbc.rar)

    Hi,
    where can i find the BI Java Connector Files:
    bi_sdk_jdbc.rar
    bi_sdk_xmla.rar
    bi_sdk_sapq.rar
    bi_sdk_odbo.rar
    Can anyone help me?

    hi Christian,
    these files should be included in bi java sdk
    https://www.sdn.sap.com/irj/sdn/downloaditem?rid=/webcontent/uuid/78b3db58-0501-0010-b895-f75cd8fdf674 [original link is broken]
    hope this helps.

  • How to find the absolute path of file  which store in KM foler ?

    Hello everyone:
         We want to develop an ABAP program which can write files into KM folder directly.
         So I need to find the absolute path of file which store in KM folder first, then we can consider the develop solution.
         Is this issue possbile that an ABAP  program write files into KM folder  directly ?
         Is there anybody had done this job ?
    Best Regards,
    Jianguo Chen

    Hi,
    http://forum.java.sun.com/thread.jsp?forum=34&thread=36
    612The methods in the above topic seem to be available when use a DOM parser..

  • How to find the main window?

    Hi, can someone help me. I cant find the main multi track window. Ive looked in the window drop bar and searched with no luck and its starting 2 get annoying. Please any info would help

    I got it from a mate who's doing a music degree. Its the educational version its authentic. I was having problems with it just shutting down on me in the middle of a session so I re-installed the programme then when i ran it ther were no windows. I had to click on the window bar to make them appear but i dont know how th make the main multi track window appear? I installed the patch but still no change. Its probably somthing i have to open ye?

  • How to find the size of a file or folder

    How can I find the size of a file or folder?
    I am trying to determine the size of my iPhoto and Mail folder.
    It says "Size: --" under general from Get Info.

    It's working fine...
    When you ask for that info, and Finder presents those '--' dashes instead of a value, actually, Finder is calculating the value in background.
    That's something that i recently noticed and wonder why tha heck he needs to do all that work by himself, kinda re-inventing the wheel of file size value "calculus"...
    I posted some thoughts about it here: File / Folder size... How do Finder gets it?
    Will appreciate feedback about this!
    Props!

  • How to run the imported java class in form

    Help!!!!!
    Pls help me to run the imported java class in forms.
    Package is created in forms while imported one class called
    singlexml.class and that package has one procedure and one
    function.
    I just wanted to run that class.I mean the new package.
    Thanks
    Anil

    Hi,
    It is because the converter works on byte code and it only supports a subset of the Java language (see the JC specifications). It is kind of like compiling you code on Java 6 and trying to run it on Java 5. The JCDK outlines the required compiler version.
    Cheers,
    Shane

  • How to find the resolution of media files in mac

    how to see the resolution of media files in mac?
    WIndows show the resolution when putting the mouse over the file.

    Hi Austin
    I should have describe more clearly.
    What I mean is for video files, I cannot see the resloution of the file. For example, 1980x1080 or 1080x720 so on
    Sometimes they do show

  • Can't find the imported java class when run .jsp file

    Hi,
    I want to run a jsp web application using tomcat. I put all my .jsp files under "TOMCAT_HOME/webapps/junmin" directory, and put all .class files under "TOMCAT_HOME/webapps/junmin/WEB-INF/classes" directory. I set up TOMCAT_HOME AND JAVA_HOME already. But when I type in the address like below:
    http://db1.acad.emich.edu:8080/junmin/login.jsp
    The IE will give me error msg indicating that it can't find all the .class files which I imported them in login.jsp file.
    So, does anyone know that if I miss some configuration in order to let the .jsp file recognize the .class files. Thanks a lot!
    Sincerely, Junmin

    Ha, this might be the reason.
    Can I add sth like this:
    <Context path="/junmin" docbase="junmin" debug=0 reloadable=true>
    </Context>
    But in my local computer, I didn't add this <Context> either. It works well.
    Thanks a lot! I will ask the administrator to try this.
    And will write down the reason.
    Sincerely, Junmin

  • How can i run a java class file from shell?

    Hi all,
    I've a .class file named "File" that contains Main method, it is in the package "File2".
    How can I run it by shell command?
    PS: "java -cp . file" doesn't work it launch->
    Exception in thread "main" java.lang.NoClassDefFoundError: File2/File (wrong name: File2/File)
    Thanks in advance.

    Just to understand: is File2 ar jar archive or not? If it is a jar archive, have you tried open File2.jar? If File2 is a directory within the current directory, have you tried java -cp . File2/File? I just tested with a set of classes and it works... Let me be precise:
    * Let us imagine you are working in a directory whole path is PathToDir/
    * in this directory you have the classes put in a directory called File2
    * in order to launch File.class then you would have to invoke :
    cd PathToDir/ (just to be sure)
    java -cp . File2/File
    *if you were to do the following then you would have the problem you describe
    cd PathToDir/File2/
    java -cp . File

  • How to hide the password in .class file?

    Hi All,
    I try to use a Connect.java file to connect to MySQL. The URL is similar to the following:
    "jdbc:mysql://192.168.1.1/database?user=name&password=123456"
    When I compile the .java file to a .class file, I can still see the full URL line in the machine codes of the Connect.class file.
    How to avoid exposing the password in the line?
    Thank you.
    Anthony Pong

    1) Use obfuscate option in your Java compiler
    2) There is Jakarta tool BCEL - which can be used for
    obfuscation, etcObfuscation tools don't obfuscate single literal string contents, which is the problem here.
    You'll have to make sure that your string doesn't appear as a single string anywhere. One technique is to break up your password into pieces, and scatter the declarations around, and join them up in the code to construct your password.
    (Oh yeah, and don't call your variables "static private final String passwordPiece1="foo";" either :-), or use an obfuscation tool to hide these variable names).

  • Is it possible to get the Source from the Compiled Java Class File?

    Hello All,
    I wrote a java file which uses Java Swing to crea a GUI.I have also compiled the jave file.
    The problem now is that i've made many changes and compiled it many times.Now suddenly due to some problem,the contents of tha Java file have been deleted and it shows 0 bytes.
    Is there any way to recover my Java source file from the Class file?I would be thankful to anyone who can help me out on this.
    Thanks in Advance,
    Regards,
    Vijayakannan

    Yes and no, you can reverse engineer it to an extent, it wont look exactly like your original source though, it'll be full of commented out bytecode bits etc. As its your own code though you've got the best chance of deciphering it. Go to somewhere like www.tucows.com to download the software for doing it.
    ARB

  • How to keep the generated java classes for compiled jsp in WL9.2 Workshop

    Hi all,
              <p>
              It should be a very simple question for most of you, however, it seems a bit tricky to me: how to configure the Weblogic 9.2 workshop so that we could keep the generated java files for the compiled jsp when we ran the application within WL 9.2 workshop?
              <p>
              I try some configurations, but not working. Also, where are the generated java files stored?
              <p>
              Thanks for the help!
              <p>
              Agnes
              Edited by wingagnes at 03/21/2008 7:51 AM

    Hi yzeng,
              <p>
              Thanks for the reply. If I change the jsp-descriptor into the following:
              <p>
              <jsp-descriptor>
              <p>
              <keepgenerated>true</keepgenerated>
              <p>
              <working-dir>D:\temp\golGenerated</working-dir>
              <p>
              <debug>true</debug>
              <p>
              </jsp-descriptor>
              <p>
              I will get the following error message:
              <p>
              cvs-complex-type.2.3.d:Invalid content was found starting with element 'precompile'. No child element is expected at this point.
              <p>
              Thanks,
              <p>
              Agnes

  • How to find the contents of a file that is suddenly empty

    I created a folder 2 months ago on the left hand side of the email under TRASH and then Under 2013. I have been loading it with emails (maybe 20-30 at last count) and all of a sudden the contents of the folder is gone. Once, when I clicked on it, it came back and I thought it was here to stay, but then everything in it disappeared again and I have not been able to find the contents for several days now. It is not in TRASH or 2013 - can't locate the emails anywhere. Just before this happened, it was no longer accepting emails from my inbox when I tried to transfer them over. I figured it had run out of space, and was ready to open a new file, but there is nothing there either. Any ideas?

    If you logon to webmail account via a browser, can you see the missing folders and emails?

  • How to find the encoding of a file?

    hi,
    Is it possible to findout the encoding of a file through programing?
    thanks,
    Mahi

    thanks tcristino for update,
    but this link contains the info about BOM. Is it possible to know the BOM data from programming?
    thanks,
    Mahender

  • How to find the main sql

    Hi all,
    I'm working on a 11.2 Oracle Enterprise database.
    I need a query to find the top 10 queries of my database. Please could you help me?
    Best regards
    dbajug

    moreajays wrote:
    Hi,
    AWR will give you all historic sql details
    @?/rdbms/admin/awrsqrpt.sql
    To know current top CPU queries you can use below sql
    col sql_text for a80
    set pages 200
    set line 900
    col PROGRAM for a20
    col MACHINE for a20
    col CPU 9999999999
    alter session set nls_date_format='dd-mon-yyyy hh24:mi:ss';
    col event for a40
    select *
    from (select /*+ rule */
    sa.sql_id,
    sa.CPU_TIME "CPU",
    s.sid "SID",
    s.serial# "SERIAL",
    s.program "PROGRAM",
    s.machine "MACHINE",
    sa.SQL_TEXT "SQL_TEXT",
    vp.spid,
    sw.event,
    s.logon_time,
    s.last_call_et / 60,
    s.username,
    s.status
    from v$sqlarea sa, v$session s, v$process vp, v$session_wait sw
    where sa.address = s.sql_address
    and sw.sid = s.sid
    and s.paddr = vp.addr
    order by CPU_TIME desc)
    where rownum < 10;Thanks,
    Ajay More
    http://www.moreajays.com
    Hey? This query is not going to help.
    Your join condition sa.address = s.sql_address will exclude all SQLs that are not the most recently executed by a session.
    And you are listing the same SQL several times if it is executed by multiple sessions, but taking no account of the number of times it was executed.
    You need to run something much simpler. Perhapsselect sql_text,executions,disk_reads,buffer_gets,cpu_time,elapsed time from v$sql order by....;run it several times, sorting it on each of the projected columns.

Maybe you are looking for