Calling JAR inside WAR

Dear experts,
I hope this is the right place to post such question. I have a web and desktop app developed using netbeans and to be built into a JAR(J) and WAR (W) file. I would like to know if it is possible for the (J) to call some other JAR (or .class) inside the (W)? Our ultimate goal is to share common classes between two apps, and hopefully no need to re-build the (J) when (W) is modified, or vice-versa. I hope my explaination is clear enough. Any comments and sugguestions is welcomed and appreciated, thanks.

Remember that whatever servlet container (appserver) that you are using does not actually execute a WAR file but deploys its contents to a particular location.
The contents can be JAR's, classes, images, whatever, but you need to specifiy in the classpath the JARs and class files that you wish to use.
It is always a good idea though to rebuild the WAR file if you make a change to a JAR file that is contained in that WAR file. It should be rebuilt and redeployed.
It is not good to manually change Jar files after the WAR is deployed.

Similar Messages

  • Call *.jar inside the trigger (MS SQL)

    Hi!
    I'm just looking around google and can't find any good news.. The problem is: how to call *.jar inside the trigger. Trigger is stored in M$ Server.
    Tnx, if any response! ;)

    What?

  • Calling jar inside dll methods

    Hello,
    Can anyone give me a brief explanation on how to use the methods of a dll (made on c++) from java?
    I would like to put the dll inside the jar/cab file along with the java classes.
    best regards
    Jonathan

    Thank you, I checked the links which are were very instructional.
    But I have one question remaining: How can I make reference to a dll inside my jar/cab file?
    the line System.loadLibrary("xxx") load just dlls from the local machine?
    best regards
    Jonathan

  • Read XML file inside WAR

    Hi,
    I have an application developed using struts. I am deploying in weblogic 8.1
    I have an xml file placed inside the WAR under a folder props.
    How can i read the file in my action class or in a utility class?
    please let me know the solution
    thanks in advance
    Srinivas

    Try this ...
    actually this can read the embedded files in the jar file.
    as i understand there is no difference between .jar and .war file (only sematic diff)
    so if this helps , please do let me know..
    URL url = <your action class>.getClass().getResource("/props/your.xml");
              System.out.println(url);
              try
                   InputStream is = url.openStream();     
                   BufferedReader br = new BufferedReader(new InputStreamReader(is));
                   String line = br.readLine();
                   while(line!=null)
                        System.out.println(line);
                        line = br.readLine();     
              }catch(Exception e)
                   System.out.println(e);
    plase be a little careful about the path for getResource ..
    Thanks

  • Loading jars inside jars

    I'm currently building a console launcher that automatically fetches the console UI classes from servers and then caches them to client machine. User can then launch console UIs of different kinds of servers using unified launcher.
    My problem is that most of the console UIs are dependant of other libraries and extracting these libs inside the UI jar is not an option. I've tried to package all jars including the console UI application itself into a another jar but hitting the wall currently when I try to accomplish something like this:
    1. Check if disk cache already contains the jar file with md5
    2. If not fetch the jar to disk
    3. Open the jar file
    4. Fetch all jars inside the jar and pass them to new classloader from classloaderpool <- This is where i hit the wall as I can't figure how to make the classloading of jars inside another jar.
    It seems that i can't create JarFile instances from inputstreams but only from specified filenames.
    I tried to use uberjar from codehaus but couldn't figure how to instantiate the main class of the console ui with parameters from inside another application.

    I suddenly find myself with a similar problem. My app is deployed with webstart, but I need to put a jar file in there (edtftpj-1.3.2.jar) so it can use FTP. Where do I put it? Right now it's inside a lib directory, but it's not getting found by the app that calls it.
    Help?
    --- Eric

  • How to implement singleton service if i m using only jar and war component

    hello,
    in my application i m using only jar and war component .
    as i m not using EAR for deployment so i dont have weblogic-application.xml file.
    so in this case how i implement weblogic singleton service .and how to call active method

    From the documentation:
    After you have created a singleton service class using the SingletonService interface, you must define it as a singleton service within WebLogic Server. This singleton service object contains the following information:
    The path to the class to load as the singleton service.
    The preferred server and other candidate servers for the singleton service.
    The following excerpt from the cluster element of config.xml shows how a singleton service is defined:
    <singleton-service>
    <name>SingletonTestServiceName</name>
    <user-preferred-server>myManaged1</user-preferred-server>
    <class-name>mycompany.myprogram.subpackage.SingletonTestServiceImpl</class-name>
    <cluster>myCluster</cluster>
    </singleton-service>
    Note that the config.xml is located in the <domain-home>/config directory

  • HT201303 Hi my iTunes account has been hacked by someone in Canada, they downloaded a game called "Game of War fire age" the game is free but the in app purchases are up to £69.99 each time for gold I am very concerned about the security of ITunes at this

    My iTunes account has been hacked via Canada according to an email from apple some one in china tried a few weeks ago but failed.
    I changed my password a couple time now but it seems that someone has hacked it and downloaded a free game called "game of war fire age" as I said its a free game but the in app purchases can be up to £69.99 per purchase of gold?
    This is a worrying thought that my account has been compromised and I am unsure of what to do about it.
    I would like to open a new account but would I be able to transfer all my purchases over to a new account any advice is welcome many thanks for your time.

    i recieved the same email with the same game and it also stated the purchase was from canada i have revieved a few other as well and am concerned i have changed my password a few times now but i still revcieve emails and am very worried. i recieved the email near the date this question had been put up
    however i do not know how they are downloading apps as my credit card details need verification when i download anything , any help would be much appreciated.

  • JARs inside my JAR

    Hi Folks,
    I'm creating a JAR file for my application. My app uses another JAR file and I want to package it inside my jar.
    I tried to use "Path-Class" attribute in MANIFEST.MF file but without success.
    Any help would be appreciate.
    TIA.
    Romualdo Rubens de Freitas

    I wonder how you missed to recognize that jars DO contain jars for four years, as you subscribed in 2001.
    Of course the standard class loader cannot handle jars in jars, but many solutions do exist for this problem. (It was really a problem, since almost all java applications are required to ship with jars inside jars).
    The best solution I encountered, is the fat_jar plugin for eclipse. If you are not an eclipse user try ONEJar.
    Being silent is sometimes better than to provide non-solutions for problems for which solutions exist.

  • Call transaction inside Update task

    <b>Is it possible to use call transaction inside an update function module?</b>
    My requirement is like this.
    When I execute LB10 storage units will be created..then we have to go to lt09 and then create a TO's there for all these Storage units..
    Now, when I try to call a bdc session from an exit, the storage units are not  updated there. so the BDC is getting failed..
    To resolve this, I kept all the BDC code in to a Zfunction module and made it an update funtion module. I am calling this function module form the exit IN UPDATE TASK.
    But the call transaction is not working....
    I have tried with L_TO_CREATE_MOVE_SU inside the Z function module..Still no use..
    is there any other way that I can solve this?

    Hi,
       Calling a FM in Update Task is one of the bundling techniques used in ABAP to avail functionality provided by SAP Update System. Here all database updates are processed at the end of the SAP LUW in contrast to normal FM call where the database updates are done and commited at the time of call (Database LUW). It is necessary to bundle all your database updates in an SAP LUW e.g. all database updates in a transaction (like VA01) should be bundled. Almost all standard SAP transactions use bundling techniques.
    This technique separates the dialog process and update process. The dialog part of the transaction can span more than one screen(one dialog step) and can be processsed by more than one dialog work process. A work process is released when the dialog step changes (screen changes) and the work process sends a database commit (called Implicit Database LUW). So with each screen change there is a database commit and database remains in consistent state.
    Now when using bundling technique, when a COMMIT WORK is encountered, system ends the dialog process with a dialog work porcess and starts the update process using an update work process.
    The dialog step containing the COMMIT WORK is considerd as the last dialog step of the transaction and all the update function modules are processed now in the last dialog step by the update work process though they were called earlier during the earlier dialog steps.
    It is necessary to create update FMs to take advantage of this technique. The update FM is created FM by setting the Update moduleradiobutton in the Attributes tab in SE37.
    In a normal FM call, if there are database updates (UPDATE, INSERT, MODIFY, DELETE) than database is commited after the FM processing is over as the FM starts its own Database LUW and ends it too.
    <b>Reward Points</b>
    Regards

  • Using JMX to read ejb manifest jar and ejb-jar.xml in ejb jar inside ear

    Hello,
    I have an ear deployed on weblogic console. I need to check contents of manifest file and ejb-jar.xml of a jar that is present in the deployed ear.
    Currently I am using below code to access jar inside ear deployed :
    Hashtable env = new Hashtable(5);
    env.put(Context.INITIAL_CONTEXT_FACTORY,
    "weblogic.jndi.WLInitialContextFactory");
    env.put(Context.PROVIDER_URL,
    url);
    env.put(Context.SECURITY_PRINCIPAL, user);
    env.put(Context.SECURITY_CREDENTIALS, password);
    Context ctx = new InitialContext(env);
    mBeanHome = (MBeanHome)ctx.lookup(MBeanHome.ADMIN_JNDI_NAME);
    String type = "EJBComponentRuntime";
    Set beans = mBeanHome.getMBeansByType(type);
    try{
    for(Iterator it=beans.iterator();it.hasNext();)
    EJBComponentRuntimeMBean rt = (EJBComponentRuntimeMBean)it.next();
    if(rt.getParent().getName().equals("xxx")){
    System.out.println(rt.getName());
    l.add(rt.getName());
    Here xxx is the ear. Now I need to get inside the jar (represented) by variable rt and access its manifest file,ejb-jar.xml
    Does anyone have an idea how to do this?
    regards
    Sameer

    Isn't it possible to put them there manually? :)

  • Call procedure inside from another procedure.

    I have Procedure Name stored in tables.
    Based on certain logic i need to call some procedure.
    Procedure will be called from inside the procedure.
    How can i apply this logic.
    Please provide any explain.
    Regards,
    AgrawalV
    Message was edited by:
    AgrawalV

    Example: Re: How to make a dynamic function call from within a package procedure

  • Call function inside running class

    Hey All,
    i have a two question in classes.
    1- i have class and i called its before and its running on runtime. i need to call function inside this class from another class, but without call the first one again, because if i called it, it will run default class function again
    is this doable ?
    2- What super() mean ?
    Thanks a lot.

    this is the default call, and when i call the method by this way its will run the default class function before call the method.
    here my example:
    i need to call checkboxes  function in ChannelsMain class without pass by the grey script.
    Note: the call_cb is working and the trace is working
    so i now the class is running, i need to call the checkboxes without ( var ci:YourClass = new YourClass(); )
    package com.link
         import fl.controls.CheckBox;
         import flash.events.*;
         public class ChannelsMain
              var cbLength:uint = Main.PV.channel_id.length;
              public function ChannelsMain()
                   // constructor code
                   for (var i:int = 0; i < cbLength; i++)
                        var cb:CheckBox = new CheckBox;
                        cb.name = Main.PV.channel_id[i];
                        cb.label = Main.PV.channel_name[i];
                        cb.x = 50;
                        cb.y = 50 + i * 30;
                        cb.addEventListener(Event.CHANGE,call_cb);
                        Main.MS.addChild(cb);
                        //call xml function
                        if(i == cbLength - 1)
                             new ChannelsXML();
              private function call_cb(evt:Event)
                   trace(evt.currentTarget.name,evt.currentTarget.selected);
              public function checkboxes(evt)
                   trace(evt);

  • CAll method inside layout

    Hi all,
             how can we call method inside Layout

    Hi,
    Layout is used for designing,
    Code can be written in eventhandler, you can call the methods in eventhandler.
    Please refer the following links for more information.
    [Layout|http://help.sap.com/saphelp_nw70/helpdata/en/e6/a85e3ba69d493ce10000000a11402f/content.htm]
    [Event Handler|https://wiki.sdn.sap.com/wiki/display/BSP/EventHandlersin+BSP]
    Hope this helps you.
    Regards
    Rajani

  • Accessing jar inside  javascript

    Hi,
    Is there way to access a jar inside a javascript?

    BigDaddyLoveHandles wrote:
    anu1 wrote:
    HTML mailto has 255 character limit. I need to send more than 7000- characters in its body. Any advise how it can be done.
    Some body suggested me to use jar inside a javascript.Very good. Next time you ask a question, why not provide this sort of detail?Better still, next time you get ridiculous-sounding advice, ask the person who gave you that advice for more details. Or why you should do that. Or how you should do that. Because that particular piece of advice isn't just ridiculous-sounding, it's just plain ridiculous.
    Or it's possible you weren't really given ridiculous advice, it's possible you misunderstood. In which case asking the person who gave you the advice to clarify it would have been a good strategy too.

  • List the contents of jar, ear, war files

    Hi All,
    It has been several years since I have worked in java and now I am trying to get caught back up :-).
    My question is: Is there a standard utility that can dump/list the contents of the packaging files: jar, ear, war?
    Thanks in advance!

    You can use winzip. OR you can use the jar command provided in JDK.
    jar -tvf <<your archive (jar, war, ear)>>

Maybe you are looking for

  • Bug or User Error - Virtual Copy

    All, I'm still on 1.3.1 (still too much dust flying on 1.4.1), Mac OS X 10.4. The situation is as follows: Took a standard RAW image file from Canon 40D. 1. Made a virtual copy of the original, crop aspect set to 8x10, made adjustments, etc. includin

  • How can we place an image in already created inline graphic frame?

    Hi, AIM:: To place an image in the inline graphic frame. OBSERVATION:: As i have analysed the snippet Runner,i came to know that it allows to load the placegun with the file(in my case image). but in order to place it,we need to click on the document

  • Cannot open attachment file

    hi befor i upgrade to 5.1.1 ther was no problem to open pdf and doc file but after the upgrade when i am traing to open this file i get gray win and i traid adobe app and ather apps need your help please thanks

  • Moving through a vector

    Help I have retrieved the data below from a database and stored into a vector. (each row is stored into an array and in turn each row is stored into a vector). Now I have to show this data quarterly (add january, feb and mar into one quarter and so o

  • Apple ID Blatantly Incorrect

         Whenever my iPhone tries to sync (both wired and over-the-air) it displays a message stating that iTunes failed to download a few songs.  These are songs I have never aquired, from iTunes or elsewhere, and have never come into contact with, let