How to get the jar file without knowing its name and any class inside it?

Hello, everybody!
I would like to know if there's a way to get a reference programatically to the initial jar without knowing its name and any class contained in it. By "initial jar" I mean the jar that was called in the prompt, like this:
java -jar jarfile.jaror in another way, in a graphical system. To be sincere what I really want is to get a reference to the jar's manifest, but I know if I can get a reference to the jar I can get a reference to its manifest file. Or if you know a way to get the manifest directly, it would also help. So, is there a way to do this?
Thank you.
Marcos

jverd wrote:
marcos_aps wrote:
abillconsl wrote:
Can you be more specific - IOW, can you cite a specific case?Absolutely. I want to access the jar in source code with the java.util.zip.JarFile class, for example.But why? You still haven't provided a use case or explained what you're trying to accomplish. As already pointed out, whatever you're trying to do, this is a brittle solution. If you explain what you're trying to accomplish with this, somebody may be able to suggest a better approach.jverd, I explained for baftos. Anyway, I will try to be more specific. I start my sytem like this, from, say, for example, jar1.jar:
import br.product.System;
public static void main(String[] args)
    System.start("NameOfTheSystem");
}The System class is in util.jar, for example. This jar is used by all systems. I wouldn't like to pass in the name of the system, as above. I would like that the System class could read it from jar1.jar's manifest file. I just would like to have this:
import br.product.System;
public static void main(String[] args)
    System.start();
}It is more elegant and I don't have the name of the system in two places: code and manifest file.
Marcos

Similar Messages

  • I accidentally deleted all my apps and music. I can re-download the music but don't know how to get the apps back without buying them again. Any thoughts?

    I accidentally deleted all my apps and music. I can re-download the music but don't know how to get the apps back without buying them again. Any thoughts?

    Just follow this:
    Downloading past purchases from the App Store, iBookstore, and iTunes Store

  • How to get the update file without using Nokia Sof...

    The network connection is unreliable and downloading the firmware update using PC Suite for my Nokia E90 proves difficult. Does anyone know how I can get the firmware version 300.34.84?
    The trouble is Nokia's Software Updater does not accommodate any slight interruption to the connection during the update process. I will update this discussion with what version of PC Suite I have once I get that info.
    Any help is kindly appreciated

    In fact, it is not Possible to get the update file without using Nokia Software Updater or you should search the net to find the update files in another place and even you get them, you can not use them with NSU.
    You can Update your Device with:
    1 - NSU (Nokia Software Update)
    2 - FOTA (Firmware Over The Air) for FP2 devices ONLY.
    3 - Nokia Care Center
    there is not other way to upgrade.
    Hope useful for u.
    regards
    Nokia N79 4GB
    SW Version: 32.001 RM-348 MEA

  • How should I create JAR file which  contain JMF library and project classes

    Hi,
    I installed the JMF windows pack. I compiled and ran successfully myApplet (which use JMF librarie) in Internet Explorer on my machine. When I run this applet on some different machine, where JMF isn�t installed- it�s not running.
    There is an error:
    java.lang.NoClassDefFoundError: javax/media/ControllerListener
    I was trying to create jar file, which contain librarie JMF.jar and all other files which are require to run myApplet (*.jar, *.class, the files from folder �MyApplet�) and run it on the other computer. It still doesn�t work.
    Also I ran a JMF Customizer and created customize.jar but this file contains only JMF classes. I don�t know how add other files to it.
    How should I create a jar file which will contains all essential files to run myApplet on other machine (something like �All In One� J )
    I�m using Eclipse.
    Can somebody help me?.
    Thank You!
    Best regards:
    Peter

    Hi
    i want to make a jar file of application which is using JMF to play audio
    and video. it works well during compilation and execution but doesn't
    works in jar file.
    please help me how i make a jar file whic will run audio and video too
    your's truely
    abdul

  • How to get the current node element by its value?

    e.g,:
    wdContext.current<b>Deal</b>Element().setAttributeValue("<i>deal_id</i>","<i>aaaaaaa</i>");
    above code can get the result i wanna.
    but now i wanna in terms of its node'name to  set attribute vaue of itself. in other words,i have no idea about how to get the current node element by its name"<b>Deal</b>".

    Hi Wing,
    The answer is there in your question itself.
    wdContext.currentDealElement()
    will give you the current node element by its name"Deal" or you could use
    wdContext.nodeDeal().getCurrentElement()
    or you could use
    wdContext.nodeDeal().getElementAt(wdContext.nodeDeal().getLeadSelection())
    Regards,
    Sudeep

  • Where i will get  the .jar files for JDBC connector for MSSQL Server

    Hi,
    i am trying to configure the JDBC connector for the MSSQL server. For this we need to add the .jar files for MSSQL Server. Can any body tell , where i will will get the jar files to finish this connection.
    Database version is MS SQL Server 2000
    Portal version is       Portal7.0 sp9
    Regards
    vijay

    Hi Vijay,
    If you are looking for the exact steps as to how we can configure the JDBC Connector for accessing the MS SQL Server, have a look at this document:
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/b00917dc-ead4-2910-3ebb-b0a63e49ef10
    Follow the steps till page 12 of this doc.
    Bye
    Ankur
    Do reward points for helpful as well as solved answers!!

  • Help me out to get the jar files for FileUpload using MyFaces.

    hi,
    Can anyone help to get the jar files for FileUpload using MyFaces.
    I want myfaces-extensions.jar and commons-fileupload-1.0.jar.
    Thank you.

    you can't control the speed of a for-loop.
    you can remove your code from a for-loop and use a function to execute the code in your for-loop and you control how frequently you call the function.

  • How to list the JAR files loaded into the Oracle Database ?

    How to list the JAR files loaded into the Oracle Database ?

    From 11.1 onwards, the below two views are available to identify the jar files loaded into the Database.
    JAVAJAR$
    JAVAJAROBJECTS$
    By querying the JAVAJAR$ view you can know information about the JAR files loaded into the Database and using JAVAJAROBJECTS$ view you can find all the java objects associated with the given JAR file.
    These views are populated everytime you use LOADJAVA with "-jarsasdbobjects" option to load your custom java classes.
    But unfortunately this feature is available only from 11.1 onwards and there is no clear workaround for above in 10.2 or earlier.

  • How to get the ard file of crystal reports

    Hi all,
    I have downloaded crystal reports from sap market place but i dont have .ard file for that how to transfer that reports into sap. How to get the ard file please help me out.
    Thanks & Regards,
    Murtuza Ahmed.

    When you click on your SAPCrystalSetup.exe and select the path to your add-on folder it will install the files and your ard file will be situated in your add-on folder.  Then you can start SAP up and install it from SAP. 
    So if your SAP install is in your local drive your ard file for crystal reports should be here C:\Program Files\SAP\SAP Business One\AddOns\SAP_CR
    Hope this helps.

  • How to get the wsdl file

    hi all,
    here java people have given wsdl file to me, how to do the scenario,
    and how to get the wsdl file from the java people.
    regards,
    priya

    Hello Priya,
    Go to http://<hostname>:50000/wsnavigator or any other UDDI server and search for the web service to be invoked
    There you can find the Webservice Definition (WSDL) file.
    Check this weblog:
    Invoke Webservices using SAPXI
    regards
    Gangaprasad

  • How to get Jxl.jar file

    Hi,
    Can any one tell me how to get Jxl.jar file.
    Thanks & Regards,
    Laxmi

    Hi,
    [jxl.jar|http://www.java2s.com/Code/JarDownload/jxl.jar.zip]
    or else
    open google, and serach for download jxl.jar
    Regards,
    Srinivas

  • VISA: How to get the CSV file through C/C++ code?

    How to get the CSV file through C/C++ code?
    I'm communicating with a USB oscilloscope using VISA.

    Thank you for your reply.
    I am using Apache Commons File Upload. Here is the code where I got the "fi".
         DiskFileUpload fu = new DiskFileUpload();
              fu.setSizeMax(1000000000);
              List fileItems = fu.parseRequest(request);
             Iterator itr = fileItems.iterator();
              FileItem fi = (FileItem)itr.next();
              if(!fi.isFormField())
                File tempFileRef  = new File(fi.getName());
         System.out.println("Field = "+tempFileRef.getAbsolutePath());
         }

  • How to restore a control file without having its backup

    Hi,
    Can any one please suggest me how to restore a control file without having its backup.
    Thanks

    To add to what SB said, in years past the instructions for re-creating the control file manually were contained in the DBA Administration manual. It used to be and may still be common to be taking and saving a "backup control file to trace" for this purpose.
    If you lost only the primary copy of the control file and it is an OS file then while the database is shutdown you can copy the secondary over the primary and then use if to start the database. If the control file is stored in ASM then there should be a way to perform the copy via ASM.
    If you use rman for backups then a copy of the control file should be part of the backup process and you can retrieve it from the backup set then perform recovery using the backup control file though I do note the OP said something to the effect no backup exists. Still, I have knows of instances where the DBA did not realize that the backup set contained the control file and the spfile so I think this is worth mentioning just in case.
    HTH -- Mark D Powell --

  • How to get the current logged in username from windows and put it into an AS var

    Hello,
    I was hopeing someone would know how to get the current logged in username from windows and put it into a var, so I can create a dynamic text box to display it.
    Thanks in advance
    Michael

    Just for everyone’s info, this is the script I have used to get the logged in windows username into flash ---- not and air app.
    In the html page that publishes with the .swf file under the <head> section:-
    <script language="JavaScript" type="text/javascript">
    function findUserName() {
         var wshell=new ActiveXObject ("wscript.shell");
         var username=wshell.ExpandEnvironmentStrings("%username%");
         return username;
    </script>
    The ActionScript:-
    import flash.external.ExternalInterface;
    var username:String = ExternalInterface.call ("findUserName");
    trace (username); // a quick test to see it in output

  • Copy file without retyping its name

    I`m just starting to use Java (in school) so I need help even with simple things like this: I have to copy file without retyping its name in destination. I`ve tried to use substring method for extracting filename, but it gives me an error "The method substring() is undefined for type Copy". Any help?
    import java.io.BufferedReader;
    import java.io.FileInputStream;
    import java.io.FileNotFoundException;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.io.InputStreamReader;
    public class Copy{
         * @param args
         public static void main(String[] args) {
              try {
                   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    //Entering the path to the file that I want to copy
                   System.out.println("Enter file path");
                   String filePath= br.readLine();
    //Entering the destination for copied file
                   System.out.println("Enter destination");
                   String destination = br.readLine();
                   FileInputStream fis = new FileInputStream(filePath);
                   FileOutputStream fos = new FileOutputStream(destination);
                   int c=0;
                   while((c=fis.read())!=-1){
                        fos.write(c);
                   fis.close();
                   fos.close();
              } catch (FileNotFoundException e) {
                   e.printStackTrace();
              } catch (IOException e) {
                   e.printStackTrace();
    }

    cereal_killer wrote:
    No. I expected this (String fileName = substring(filePath.lastIndexOf("/")+1, filePath.length());) to workYou didn't provide a string reference on which to execute substring. As in:
    String str = "blah blah blah";
    String fileName = str.substring(...);
    {code}If you just say *substring(start, end)* how is it supposed to know *which* String object to operate on?
    Without the someStringReference. preceding it, calling a method--in your case substring--is like calling it on this object, i.e., like this.substring. Your class does not define a substring method, so it's a compile time error to try to call that non-existent method.

Maybe you are looking for