How to load jar file in one shot?

I have a Java app refers some jar files on remote location. Loading class by class is very time consuming.
Is it possible to load the jar files as a whole? like what applet does?
Tried URLClass loading, even run java -jar, still those load class on demand.
I want the jar file loaded only one time into JVM.

I don't really understand. When you load a jar file using URLClassLoader it brings over the jar file and extracts the class files from the jar file. It does not bring over the class files as individual class files. If you mean you want to only ever bring over the jar file once then why not just copy the jar file using URLConnection and save it to disk. You can then load the jar file from disk each time the program starts.

Similar Messages

  • How to load jar file in oracle 9i???

    Hi Friends,
    Can you help me, how to load jar file oracle 9i? I have to tried to load in 10g using loadjava command but it's not working in oracle 9i because the loadjava batch file itself is not there in oralce 9i.
    Is there any other way then pls let me know.
    - Hiren Modi

    Hi,
    I have oracle version : Release 2 (9.2.0.1.0) for Windows. I have tried to execute the loadjava command from SQL prompt but its giving as below.
    H:\>loadjava
    The system cannot find the path specified.
    Do you know why its giving error like this. I have checked in dir : C:\oracle\ora92\bin but loadjava executable file is not there in it.
    - Hiren Modi

  • How to load jar file using SQL Developer

    Dear All,
    I need urgent help to load mytest.jar to the database using SQL Developer. I am able to load individual java classes to the database using SQL developers, but i could not load JAR files. Please help me any one know how to do this using SQL Developer.
    Thanks and Regards
    John p

    I don't think that's possible, so load it through the OS with the loadjava utility.
    Have fun,
    K.

  • How to load jar files from remote location

    Hi all,
    I am trying to load jar files from remote server, from a servlet which is running on OC4j.
    For doing this,First I am getting ClassLoader by using ClassLoader.getSystemClassLoader() and then type casting it to URLClassLoader.
    But by doing it I am getting ClassCastException,because oc4j returns oracle.classloader.PolicyClassLoader instead of java.net.ClassLoader.
    Appreciate if anyone can tell me how to load remote jar files using oracle.classloader.PolicyClassLoader .
    Thanks
    Harish

    Hi,
    I suppose you know about this, but just in case.
    I have used jnpl to load jar files from remote location.
    Rowan

  • How to load .jar files of subfolder in web-inf/lib folder?

    Hi All,
    In 'webapps\myappliction\WEB-INF\lib\myfolder' and in myfolder have some .jar files. How to load subfolder jar files in weblogic server 10.0?
    Do I need to configure subfolder jar path in web.xml? Please help me.
    Thanks & Regards,
    Gangadhar

    Class loaders associated with a Web application can be configured to locate local classes first. To enable this we have to set the <prefer-web-inf-classes> to true in the deployment override weblogic.xml, for example
    <container-descriptor>
    <prefer-web-inf-classes>true</prefer-web-inf-classes>
    </container-descriptor>
    http://blog.transfer-solutions.com/2010/12/weblogic-class-loading/

  • How to load Jar Files on demand

    Hi all.
    As must of you probably know, JAR files are downloaded on the initial phase when the first form is requested from the URL. This is done through the archive parameter.
    Although i recognized the advantage of such technique, there may be times, when one would wish to download certain JAR files when really needed.
    For example, the FormsGraph.jar may be needed only with certain form modules, but probably not for most. So my question is, apart from doing a web.show_document and calling the desired form with the appropiate config section, is it possible to download specific JAR files on demand???
    Thanks in advance ...!

    This is not really an "Oracle Forms" question. This is more of a java applet question that can be discussed in the Java forums.
    https://forums.oracle.com/forums/category.jspa?categoryID=285
    However, as far as I know, jar files are pulled on demand. You can easily test this with a simple form. For example, add any jar file to the ARCHIVE parameter in formsweb.cfg. Then open the JRE Control Panel and clear the cache. Now run the provided test form (test.fmx):
    http://server/forms/frmservlet?form=test
    Once the form has successfully started, open the JRE Control Panel again and open the Cache Viewer (General tab > View). Notice that the only files downloaded and cached are frmall.jar and Registry.dat. You may see a reference to your additional jar in the console, but the file was not brought down to the client. If you are seeing that a jar is being brought to the client with your own form, this is likely because your form is coded such that some code in that jar is being called and therefore is needed.

  • How to load .jar files when not specified in the .jnlp file

    Hello,
    We are deploying an application with JWS but due to the nature of this app, we need to download additional jar file only when the user has been authenticated. The jar file(s) we need to download can hardly be predicted (in term of name) and thus cannot be all listed as lazzy resource in the .jnlp file.
    However, we would like to take advantage of the various JWS features relateed to .jar download and cache and would prefer not to reinvent the wheel by implementing our on stuff (i.e. URLClassLoader with caching etc.).
    Any idea, suggestion?
    Thanks in advance.
    Fred.

    How about writing a second jnlp file with the optional jar listed in it and running it only if your user is authenticated?

  • How can load properties file for one time and use in entire application

    Hi folks,
    I dont want to read properties file every time , and want to get property value in any servelet or jsp page.(means i want to read only property file only for once and want to get value in any where ) , how to do this.
    Message was edited by:
    RajeshwarReddyT

    means we have to read file every time Know but i dont
    want to be happen that ??? No you don't . You read the file once. You store it in the hashmap. Then you hand that hashmap to whatever class needing the data.
    getProperties() returns the hashmap, doesn't read the file.
    Maybe I should have called the method getMap or something.
    Message was edited by:
    karma-9

  • How to package other jar files into one jar?

    How to package other jar files into one jar? How can i get the class in the inner jar file?

    Generally not a good idea. The Java runtime won't be able to load classes from those "inner" jars, you'd have to write your own classloader to do that. It's not a brilliant idea, generally, anyway, since the point of having lots of jars is to keep your application modular. Bundling them all together like that means you have to re-deploy the whole thing to fix, for instance, one small bug in one small library
    If you really want to do this, there's an Eclipse plugin called FatJar, but I urge you to consider whether you really want to do it first.

  • How to dynamically load jar files - limiting scope to that thread

    Dynamically loading jar files has been discussed a lot. I have read a quite a few posts, articles, and demo code for doing just that. However, I have yet to find a solution to my problem. Most people modify their system class loader and are happy. I have done that and was happy for a time. Occasionally, you will see reference to an application server or tomcat or some other large project that have successfully been able to load and unload jar files, allow for dynamic deployment of code, etc. However, I have not been able to achieve similar success; And my problem is much less complicated.
    I have an application that executes a thread to send a given file/message to a standard JMS Server Queue. Depending on the parameters selected by the user, this thread may need to communicate with one of a number of JMS Servers, ie. JBoss, WebLogic, EAServer, Glassfish, etc. All of which can be done with the same code, but each needs to load their own flavor of JMS Client Jar files. In this instance, spawning a separate JVM for each communication would work from a classloader perspective. However, I need to keep it in the family and run under the same JVM, albeit each JMS Server Connection will be created and maintained in separate Threads.
    I am close, I am doing the following...
    1. Creating a new URLClassLoader in the run() method of each thread.
    2. Set this threads contextClassLoader to the new URLClassLoader.
    3. Load the javax.jms.JMSException class with the URLClassLoader.loadClass() method.
    4. Create an initialContext object within this thread.
    Note: I read that the initialContext and subsequent conext lookup calls would use the Thread�s
    contextClassLoader for finding/loading classes.
    5. Perform context.lookup calls for a connectionFactory and Queue name.
    6. Create JMS Connection, etc. Send Message.
    Most of this seems to work. However, I am still getting a NoClassDefFoundError exception for the javax.jms.JMSException class ( Note step #3 - tried to cure unsuccessfully).
    If I include one of the JMS Client jar files ( ie wljmsclient.jar for weblogic ) in the classpath then it works for all the different JMS Servers, but I do not have confidence that each of the providers implemented these classes that now resolve the same way. It may work for now, but, I believe I am just lucky.
    Can anyone shine some light on this for me and all the others who have wanted to dynamically load classes/jar files on a per Thread basis?

    Thanks to everyone - I got it working!
    First, BenSchulz' s dumpClassLoader() method helped me to visualize the classLoader hierarchy. I am still not completely sure I understand why my initial class was always found by the systemClassLoader, but knowning that - was the step I needed to find the solution.
    Second, kdgregory suggested that I use a "glue class". I thought that I already was using a "glue class" because I did not have any JMSClient specific classes exposed to the rest of the application. They were all handled by my QueueAdmin class. However...
    The real problem turned out to be that my two isolating classes (the parent "MessageSender", and the child "QueueAdmin") were contained within the same jar file that was included in the classpath. This meant that no matter what I did the classes were loaded by the systemClassLoader. Isolating them in classes was just the first step. I had to remove them from my jar file and create another jar file just for those JMSClient specific classes. Then this jar file was only included int custom classLoader that I created when I wanted to instantiate a JMSClient session.
    I had to create an interface in the primary jar file that could be loaded by the systemClassLoader to provide the stubs for the individual methods that I needed to call in the MessageSender/QueueAdmin Classes. These JMSClient specific classes had to implement the interface so as to provide a relationship between the systemClassLoader classes and the custom classLoader classes.
    Finally, when I loaded and instantiated the JMSClient specific classes with the custom classLoader I had to cast them to the interface class in order to make the method calls necessary to send the messages to the individual JMS Servers.
    psuedu code/concept ....
    Primary Jar File   -  Included in ClassPath                                                      
    Class<?> cls = ClassLoader.loadClass( "JMSClient.MessageSender" )
    JMSClientInterface jmsClient = (JMSClientInterface) cls.newInstance()                            
    jmsClient.sendMessage()                                                                      
    JMSClient Jar File  -  Loaded by Custom ClassLoader Only
    MessageSender impliments Primary.JMSClientInterface{
        sendMessage() {
            Class<?> cls=ClassLoader.loadClass( "JMSClient.QueueAdmin" )
            QueueAdmin queueAdmin=(QueueAdmin) cls.newInstance()
            queueAdmin.JMSClientSpecificMethod()
        }

  • Loading jar files at execution time via URLClassLoader

    Hello�All,
    I'm�making�a�Java�SQL�Client.�I�have�practicaly�all�basic�work�done,�now�I'm�trying�to�improve�it.
    One�thing�I�want�it�to�do�is�to�allow�the�user�to�specify�new�drivers�and�to�use�them�to�make�new�connections.�To�do�this�I�have�this�class:�
    public�class�DriverFinder�extends�URLClassLoader{
    ����private�JarFile�jarFile�=�null;
    ����
    ����private�Vector�drivers�=�new�Vector();
    ����
    ����public�DriverFinder(String�jarName)�throws�Exception{
    ��������super(new�URL[]{�new�URL("jar",�"",�"file:"�+�new�File(jarName).getAbsolutePath()�+"!/")�},�ClassLoader.getSystemClassLoader());
    ��������jarFile�=�new�JarFile(new�File(jarName));
    ��������
    ��������/*
    ��������System.out.println("-->"�+�System.getProperty("java.class.path"));
    ��������System.setProperty("java.class.path",�System.getProperty("java.class.path")+File.pathSeparator+jarName);
    ��������System.out.println("-->"�+�System.getProperty("java.class.path"));
    ��������*/
    ��������
    ��������Enumeration�enumeration�=�jarFile.entries();
    ��������while(enumeration.hasMoreElements()){
    ������������String�className�=�((ZipEntry)enumeration.nextElement()).getName();
    ������������if(className.endsWith(".class")){
    ����������������className�=�className.substring(0,�className.length()-6);
    ����������������if(className.indexOf("Driver")!=-1)System.out.println(className);
    ����������������
    ����������������try{
    ��������������������Class�classe�=�loadClass(className,�true);
    ��������������������Class[]�interfaces�=�classe.getInterfaces();
    ��������������������for(int�i=0;�i<interfaces.length;�i++){
    ������������������������if(interfaces.getName().equals("java.sql.Driver")){
    ����������������������������drivers.add(classe);
    ������������������������}
    ��������������������}
    ��������������������Class�superclasse�=�classe.getSuperclass();
    ��������������������interfaces�=�superclasse.getInterfaces();
    ��������������������for(int�i=0;�i<interfaces.length;�i++){
    ������������������������if(interfaces[i].getName().equals("java.sql.Driver")){
    ����������������������������drivers.add(classe);
    ������������������������}
    ��������������������}
    ����������������}catch(NoClassDefFoundError�e){
    ����������������}catch(Exception�e){}
    ������������}
    ��������}
    ����}
    ����
    ����public�Enumeration�getDrivers(){
    ��������return�drivers.elements();
    ����}
    ����
    ����public�String�getJarFileName(){
    ��������return�jarFile.getName();
    ����}
    ����
    ����public�static�void�main(String[]�args)�throws�Exception{
    ��������DriverFinder�df�=�new�DriverFinder("D:/Classes/db2java.zip");
    ��������System.out.println("jar:�"�+�df.getJarFileName());
    ��������Enumeration�enumeration�=�df.getDrivers();
    ��������while(enumeration.hasMoreElements()){
    ������������Class�classe�=�(Class)enumeration.nextElement();
    ������������System.out.println(classe.getName());
    ��������}
    ����}
    It�loads�a�jar�and�searches�it�looking�for�drivers�(classes�implementing�directly�or�indirectly�interface�java.sql.Driver)�At�the�end�of�the�execution�I�have�found�all�drivers�in�the�jar�file.
    The�main�application�loads�jar�files�from�an�XML�file�and�instantiates�one�DriverFinder�for�each�jar�file.�The�problem�is�at�execution�time,�it�finds�the�drivers�and�i�think�loads�it�by�issuing�this�statement�(Class�classe�=�loadClass(className,�true);),�but�what�i�think�is�not�what�is�happening...�the�execution�of�my�code�throws�this�exception
    java.lang.ClassNotFoundException:�com.ibm.as400.access.AS400JDBCDriver
    ��������at�java.net.URLClassLoader$1.run(URLClassLoader.java:198)
    ��������at�java.security.AccessController.doPrivileged(Native�Method)
    ��������at�java.net.URLClassLoader.findClass(URLClassLoader.java:186)
    ��������at�java.lang.ClassLoader.loadClass(ClassLoader.java:299)
    ��������at�sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:265)
    ��������at�java.lang.ClassLoader.loadClass(ClassLoader.java:255)
    ��������at�java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315)
    ��������at�java.lang.Class.forName0(Native�Method)
    ��������at�java.lang.Class.forName(Class.java:140)
    ��������at�com.marmots.database.DB.<init>(DB.java:44)
    ��������at�com.marmots.dbreplicator.DBReplicatorConfigHelper.carregaConfiguracio(DBReplicatorConfigHelper.java:296)
    ��������at�com.marmots.dbreplicator.DBReplicatorConfigHelper.<init>(DBReplicatorConfigHelper.java:74)
    ��������at�com.marmots.dbreplicator.DBReplicatorAdmin.<init>(DBReplicatorAdmin.java:115)
    ��������at�com.marmots.dbreplicator.DBReplicatorAdmin.main(DBReplicatorAdmin.java:93)
    Driver�file�is�not�in�the�classpath�!!!�
    I�have�tried�also�(as�you�can�see�in�comented�lines)�to�update�System�property�java.class.path�by�adding�the�path�to�the�jar�but�neither...
    I'm�sure�I'm�making�a/some�mistake/s...�can�you�help�me?
    Thanks�in�advice,
    (if�there�is�some�incorrect�word�or�expression�excuse�me)

    Sorry i have tried to format the code, but it has changed   to �... sorry read this one...
    Hello All,
    I'm making a Java SQL Client. I have practicaly all basic work done, now I'm trying to improve it.
    One thing I want it to do is to allow the user to specify new drivers and to use them to make new connections. To do this I have this class:
    public class DriverFinder extends URLClassLoader{
    private JarFile jarFile = null;
    private Vector drivers = new Vector();
    public DriverFinder(String jarName) throws Exception{
    super(new URL[]{ new URL("jar", "", "file:" + new File(jarName).getAbsolutePath() +"!/") }, ClassLoader.getSystemClassLoader());
    jarFile = new JarFile(new File(jarName));
    System.out.println("-->" + System.getProperty("java.class.path"));
    System.setProperty("java.class.path", System.getProperty("java.class.path")+File.pathSeparator+jarName);
    System.out.println("-->" + System.getProperty("java.class.path"));
    Enumeration enumeration = jarFile.entries();
    while(enumeration.hasMoreElements()){
    String className = ((ZipEntry)enumeration.nextElement()).getName();
    if(className.endsWith(".class")){
    className = className.substring(0, className.length()-6);
    if(className.indexOf("Driver")!=-1)System.out.println(className);
    try{
    Class classe = loadClass(className, true);
    Class[] interfaces = classe.getInterfaces();
    for(int i=0; i<interfaces.length; i++){
    if(interfaces.getName().equals("java.sql.Driver")){
    drivers.add(classe);
    Class superclasse = classe.getSuperclass();
    interfaces = superclasse.getInterfaces();
    for(int i=0; i<interfaces.length; i++){
    if(interfaces[i].getName().equals("java.sql.Driver")){
    drivers.add(classe);
    }catch(NoClassDefFoundError e){
    }catch(Exception e){}
    public Enumeration getDrivers(){
    return drivers.elements();
    public String getJarFileName(){
    return jarFile.getName();
    public static void main(String[] args) throws Exception{
    DriverFinder df = new DriverFinder("D:/Classes/db2java.zip");
    System.out.println("jar: " + df.getJarFileName());
    Enumeration enumeration = df.getDrivers();
    while(enumeration.hasMoreElements()){
    Class classe = (Class)enumeration.nextElement();
    System.out.println(classe.getName());
    It loads a jar and searches it looking for drivers (classes implementing directly or indirectly interface java.sql.Driver) At the end of the execution I have found all drivers in the jar file.
    The main application loads jar files from an XML file and instantiates one DriverFinder for each jar file. The problem is at execution time, it finds the drivers and i think loads it by issuing this statement (Class classe = loadClass(className, true);), but what i think is not what is happening... the execution of my code throws this exception
    java.lang.ClassNotFoundException: com.ibm.as400.access.AS400JDBCDriver
    at java.net.URLClassLoader$1.run(URLClassLoader.java:198)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:186)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:265)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:255)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:140)
    at com.marmots.database.DB.<init>(DB.java:44)
    at com.marmots.dbreplicator.DBReplicatorConfigHelper.carregaConfiguracio(DBReplicatorConfigHelper.java:296)
    at com.marmots.dbreplicator.DBReplicatorConfigHelper.<init>(DBReplicatorConfigHelper.java:74)
    at com.marmots.dbreplicator.DBReplicatorAdmin.<init>(DBReplicatorAdmin.java:115)
    at com.marmots.dbreplicator.DBReplicatorAdmin.main(DBReplicatorAdmin.java:93)
    Driver file is not in the classpath !!!
    I have tried also (as you can see in comented lines) to update System property java.class.path by adding the path to the jar but neither...
    I'm sure I'm making a/some mistake/s... can you help me?
    Thanks in advice,
    (if there is some incorrect word or expression excuse me)

  • Help! How to create Jar file for a packaged class?

    Hi!
    I am new in jar complexities. I made a swing frame that just prompts a JOptionPane when executed. I accomplished the same using jar without packaging my class SwingTest.
    But when i package it, it doesn't run. Can any one tell me how to make jar file of packaged classes and include images in the jar files too!
    Really Thanx!

    Call the Jar from the commandline to see the exceptions thrown.
    java -jar <jarFileName> <className>

  • How TO DEPLOY JAR FILES INTO XI Server using SDM

    Hi XI Gurus,
       im working on adapter development. we have created jar file in NWDS.
       now going ahead to deploy into XI server through SDM.
       can we deploy jar files directly into xiserver through SDM. or it needs to convert to any other formate like EAR, SDA. then how would i convert to SDA.
      i any have clear idea on this... pls throw the ways how to convert........
               JAR File to EAR format
               JAR file to SDA format
               EAR file to SDA format         
       can any one explain the procedure step by step how to convert jar file into deployment archive file in order to succesfully into XI server.
              thanks  i advance. points will be rewarded.
      Regards
      Rajesh

    Hi Rajesh,
    JAR file in itself in not deployable.
    So v need to envelop this jar file into an EAR file and then v deploy this EAR file on SDM.
    Creating Jar
    Inside NWDS --> Windows --> Open perspective --> J2EE Development --> right click on ur proj --> Build EJB Archive
    Converting .EAR file to .SDA
    Converting .EAR file to .SDA
    Regards,
    Prateek

  • How to load flat file in BPS through Web-debugging

    Hi,
    We are working on flat file upload in BPS thru guide 'How to load flat file in BPS through Web'. Can some one guide on how to debug the function modules used while uploading the data.
    We have set up the break point in the function modules and also in the BSP page. But when trying to debug while uploading, it is not going to the break point which was set.
    Could you assist in setting up the break point.
    Regards,
    Sreenath
    Message was edited by:
            sreenath reddy

    Hi,
    I  have put an external break-point.
    I have hard coded it in the coding of the function module itself.
    The code is perfectly working. But, when I want to check for the values of the variables in the F.M during runtime, the break-point is not triggering. Any ideas??
    Regards,

  • Load jar file into Oracle db 10.1.0.2.0.

    Hi,
    I am trying to create a Java Stored procedure that is dependent on some other classes. The java source doesn't compile since it cannot find the imported libs.
    How can I load jar files into the database so I can get my java source to compile?
    I have heard of dbms_java.loadjava procedure, but not very clear on how to use it.
    Please let me know how I can load the jar files in to the db.
    Thanks,
    -- DR.

    http://oraclesvca2.oracle.com/docs/cd/B12037_01/java.101/b12021/dbms_jav.htm

Maybe you are looking for

  • After removing and replacing a hyperlink why is the old one still in the html code?

    I'm using a tool tip in a master page, the hyperlink is used on the base image and on the roll-over tip. See here: both elements have the new link but the old link, shown above overides the new one??? I can' seem to get rid of it!

  • Documents rows cannot be closed concurrently with the other document modify

    Hello Experts !!! Now  i am using SAP BUSINESS ONE 2007 B PATCH LEVEL 19. problem is that previously i was using patch level 4. when i was using patch level 4 , i used to punch sales order. now when i upgraded to patch level 19 .SAP is not allowing t

  • Folder Structure for portlet & configure in WL 8.1

    Hi , <b>Any one help me how to configure the portlet in WebLogic 8.1 and the Folder structure of the Portlet application. What jar file we need to provide for portlet where we download.I am not installed portlet server.</b> thx & rgds, K.Samraj

  • Geotagging in new Photos app

    Hi All, I recently upgraded to the new Photos app and realised that there doesn't seem to be a way to add location to a photo's metadata (geotagging). Can any confirm if this is true? Also any work arounds (e.g. other applications etc ) would be help

  • "404 Not Found nginx" Certificate Error when performing Google search

    Ever since I upgraded to Mavericks on my 2.4 GHz Intel iMac I have started getting occasional errors when trying to access Google sites (search, docs, calendar, YouTube, etc).  In Safari, I get the warning that the Certificate is Invalid, and when I