How to add the JAR files and configuration files to the CLASSPATH when running?

QUERY:

During execution, I need to load JAR files and relevant config (.cfg files) and file .properties files in the CLASSPATH and run a specific one of the JAR java program that is available in the CLASSPATH.


Please send me details of Java API or an example of java program to implement the use case above.


Thanks in advance.


During execution, I need to load JAR files and relevant config (.cfg files) and file .properties files in the CLASSPATH and run a specific one of the JAR java program that is available in the CLASSPATH.

Please send me details of Java API or an example of java program to implement the use case above.

You do not add to YOUR classpath once your application is launched.

You create a NEW process for the application you want to run and provide an appropriate environment for it to run in-including the CLASSPATH or PATH environment variables.

The Java API for the ProcessBuilder class has a simple example that shows how to create the arguments and to launch an external application.

ProcessBuilder (Java SE 7 platform)

There are also MANY other examples of the use of ProcessBuilder; just search the net.

Tags: Java

Similar Questions

  • How to add external jar file?

    Hi all
    1. work on the version of BB storm (9500/9530 Simulator) is v4.7.0.75
    2 opportunity BB JDE v4.7

    4. the request is:

    My application needs commans - httpclient.ja.

    If I add external jar file.

    application throws the runtime as error

    module "Commons-httpclient ' not found."

    My request is here:

    is it posible to add external jar file in blackberry?

    If so, how do I add external jar file?

    can any body help me on this point, because I am doing this for the first time

    Thanks in advance

    Abreu - Bureddy

    File JAR of Th which tent has class files not getting recognized by BB Jvm.

  • How to resize the Bitmap when running?

    Hello

    I created a Bitmap that reads directly from a file. The actual size of the image (test.png) is 360 x 50. I displayed this bitmap image in a BitmapField.  Now, I want to display this image in my application so that it should take the width of the screen and adjust (expand or compress) so based on the TILT of the device (in the case of BB storm). My code is as below:

    {
       Bitmap image = Bitmap.getBitmapResource("mainmenu_green.png");
        BitmapField bmpMainMenu = new BitmapField(image);
    
        MenuScreenVFM verticalManager = new MenuScreenVFM();
        verticalManager.add(bmpMainMenu);
        add(verticalManager );
    }
    
    //MenuScreenVFM  Class..
     static class MenuScreenVFM extends VerticalFieldManager
     {
            // Constructor
            private MenuScreenVFM()
            {
                super(Manager.VERTICAL_SCROLL | Manager.VERTICAL_SCROLLBAR | VerticalFieldManager.FIELD_HCENTER);
            }
    
           net.rim.device.api.ui.container.VerticalFieldManager#sublayout(int,int)
             */
            protected void sublayout(int width, int height)
            {
                int nTop = 65;
                Field field = getField(0);
                layoutChild(field, Display.getWidth(), 40);
                setPositionChild(field, 0, nTop);
                setExtent( Display.getWidth(), Display.getHeight());
            }
    }
    

    The image must stretch/compress based on the width of the screen. Any info/code would be really appreciated.

    Thank you

    -DK

    I created a CustomBitmapField extends the field and for the scaling of the image, I used the following code:

       public static EncodedImage scaleImageToWidth(EncodedImage encoded, int newWidth) {
                 return scaleToFactor(encoded, encoded.getWidth(), newWidth);
       }
    
        public static EncodedImage scaleImageToHeight(EncodedImage encoded, int newHeight) {
               return scaleToFactor(encoded, encoded.getHeight(), newHeight);
        }
    
        public static EncodedImage scaleToFactor(EncodedImage encoded, int curSize, int newSize) {
             int numerator = Fixed32.toFP(curSize);
             int denominator = Fixed32.toFP(newSize);
             int scale = Fixed32.div(numerator, denominator);
    
             return encoded.scaleImage32(scale, scale);
        }
    
      protected void paint(Graphics graphics) {
            graphics.setColor(backgroundColour);
            graphics.drawImage(0, 0, Display.getWidth(), fieldHeight,   this.scaleImageToWidth(bmpBG, Display.getWidth()), 0, 0, 0);
               }
    

    I would like to know if it works... If works please set Bravo... that will encourage those who post the solution

    Kind regards

    -DK

  • How to load the list when running

    hiiiiii I have total 100 events list...

    But first, I have 20 events display when I scroll the list down when I reached 20 events th I load another 20 events to the list please give me suggestions to do this to me...

    If you have all 100 items available then you should put all the entries in the ListField.

    In situations when not all are available and you must get them (from a server), a little at a time, then you might have a 'Next' button and allows to do the treatment.  Without doubt, you also need a 'Back' button  I wouldn't try to drive it when the user scrolls to the end of the list.  Because there is a long delay, get the 'next page', I think that instead of using a user interface there different - people expect a scroll to be instant.

  • How to add the Norwegian language to my ipa file in Adobe Flash Professional and AIR settings

    Hello

    How to add languages Norwegian to my file API in Adobe Flash Professional and the parameters of AIR?

    Norwegian users get my apps in English rather than Norwegian. Desperately need help!

    Cordially Ylva

    If it's a question about location, then this thread: Re: how to locate the name of the application into an air ios app? discusses explains how to add the Danish language, which is not localized to be default.

  • How to add the html file to adfc_config?

    Hello

    11.1.1.5 jdev

    How to add static html files to adfc config?

    Is - it possible and a good solution?

    Hello

    You can use the activity display URL:http://docs.oracle.com/cd/E21764_01/web.1111/b31974/taskflows_activities.htm#BACICBGF

    Arun-

  • How to add the file to the existing catalog

    Hello:

    How to add a new file already existing catalogue? If I using the regular method "-> import library", the old files will disappear.

    Thank you

    Images to be imported into Lightroom. When you go through the import process, when it has finished, it will seek you images of the previous import (import you just made). It's normal. If you look at the different sections on the left side of the library module, you'll see that "Previous import" is one of the sections. You will also notice that there is another section called "files". If you choose this section, you will be able to see the other folders that you have imported.

  • How to add the chapter name and page not for reference

    Hello

    How to add the chapter name and page not for reference in indesign CS6.

    Thank you

    Please try variable notion of text

  • How to add the data in asm file

    Hello


    Can someone let me know how to add the data using ASM file

    DB-ORACLE 10.2
    OS RHEL

    create tablespace tbl_name
    DATAFILE '+ DATA' SIZE 1 G REUSE
    autoextend on next maxsize of 250 M 2 G;

    where is your asm disk group + DATA

  • How to add the asterisk (*) next to the label of the element

    Hello

    Can someone suggest me how to add the asterisk (*) or (∞) symbol next to the label of the element in the apex oracle 4.2.2.

    Ex: -.

    1 County IN

    2 County * IN

    Thank you and best regards,

    Ibrahim Sayyed.

    Hello

    Do tag is obsolete and not supported in HTML5

    http://www.w3schools.com/tags/tag_font.asp

    Use for example duration and styles

    *
    

    Kind regards

    Jari

  • How to add the full value of two buttons?

    How to add the full value of two buttons (any key) VI and display it in the output text box? I am attaching a sample program, but I know that his evil... Help, please

    Try this

  • need to know how to block the ophcrack from running, my child uses this to get my password and in the parental controls in vista

    you want to know how to block the ophcrack from running, my child uses this to get my password and in the parental controls in vista. I have 3 accounts going 2 for children and one for the parents/administrator. I found ophcrack in several places on the computer. any help would be greatly appreciated

    The only question the idea of Malkeleah, that is when you put a password on BIOS, all you need to do is pop the battery from the motherboard and the password is gone. Faronics has in some programs such as anti-executable and a few other programs that may block the name or ID of a process and prevent it from running (some antiviruses have that option, such as Avast, but usually is a pain in the ass to configure)

  • How to add the Quazip library

    Hi, I want to try to use Quazip. Since I read, I have to add the library before use.

    I downloaded from http://quazip.sourceforge.net/

    How to add the Quazip library? Please explain the step, never add lib before.

    Thank you

    I have change the .pro file

    Like this:

    http://StackOverflow.com/questions/13341234/unzip-files-downloaded-from-Server

  • How to add the profile of lenses?

    How to add the profile of lenses?

    At the bottom of the link, you will find a link for the lens profile downloader. With this tool, you can download the profiles shared by other users.

    Work with lenses profiles in Adobe Photoshop, Lightroom and Camera Raw

  • How to add the new column in existing table to our desired location?

    How to add the new column in existing table to our desired location?

    For example, I have to add the new column 'course' before the salary column in the emp table.

    I think the best way is to add the column at the end of the table and create a new view with the order of the columns...

    Another option...

    places the data into a temporary table and recreate the table with the correct order of the columns, and then insert data to the table from the temporary table

    Refer

    Add column (from table) in the desired position

    Example:

    CREATE TABLE temp_my_user LIKE)

    SELECT * FROM password);

    DROP TABLE password;

    (Password) CREATE TABLE

    userID NUMBER

    , first name VARCAHR2 (25)

    , middleInitial VARCHAR2 (1)

    (, name VARCHAR2 (25));

    INSERT INTO password (userID, firstName, lastName)

    (SELECT username

    first name

    lastName

    OF temp_my_user);

    DROP TABLE temp_user;

Maybe you are looking for