How to pass argument in manifest file

Hi,
I want to pass argument to main class in jar. Is there any option in manifest file.

Hmm..
Seems that my sentence above isn't so correct.
It possible to add custom attribute: value pairs into manifest file and
read it later from Java class.
Here is code sample:
public class ManifestTest {
    public static void main(String[] args) {
        try {
            java.util.jar.JarFile jar = new java.util.jar.JarFile(System.getProperty("java.class.path"));
            for (java.util.Iterator it = jar.getManifest().getMainAttributes().keySet().iterator();it.hasNext();) {
                Object curKey = it.next();
                System.out.println("key: " + curKey + ", value: " + jar.getManifest().getMainAttributes().get(curKey));
        } catch (Throwable t) {
            System.out.println("exception occured: " + t);
}

Similar Messages

  • How to pass arguments to .sql file.......

    Hello,
    I want to pass arguments to .sql file which is being called from within a shell (.sh).
    suppose this is the line in shell -
    ${ORACLE_HOME}/bin/sqlplus -s abcuser/abcuser@abc < ${ABCDB_DIR}/A.sql $val >>${LOG}
    - now I want to pass '123456' to A.sql
    Please suggest how to do that.
    Thanks and regards,

    You can pass parameters to a shell script executing sql commands just like you would any other shell script.
    I have a script called test_os_variables.sh:
    sqlplus -s "/ as sysdba" << EOF
    select '$1' from dual;
    EOF
    Now I execute my script passing SHAWN as a parameter.
    ./test_os_variables.sh SHAWN
    SQL*Plus: Release 10.2.0.2.0 - Production on Tue Jan 9 08:09:46 2007
    Copyright (c) 1982, 2005, Oracle. All Rights Reserved.
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - 64bit Production
    With the Partitioning, OLAP and Data Mining options
    SQL>
    'SHAW
    SHAWN

  • Hi, i am facing problem as to how to pass arguments received by my swf file to an .exe that i have c

    hi, i am facing problem as to how to pass arguments received by my swf file to an .exe that i have created from a C++ project...do i need to tweak the code in the C++ project in some way that it accepts the input from the .swf file?

    Hi there and welcome to our community
    What you need to do is click the link below, then choose the forum most appropriate to the product you are using. In this forum we discuss the operation of the forums themselves.
    http://forums.adobe.com/index.jspa
    Best of luck to you in solving your issue! Rick

  • How to pass argument in main function ?

    How to pass arguments in main function of one class from another class ?
    I don't want to pass argument from command prompt.
    I want to try something like this -
    class Test{
    public static void main(String args[]){
    for(int i=0;i<args.length;i++)
         System.out.println(args);
    class Fun{
    public static void main(String args[]){
         Test t=new Test("Hello","good bye");
    when i run Fun class it gives error.
    Suggest me how can i do that.

    In Fun class main method does not take arguments that is fine. In Test class instead of main method you can have constructor to take input parameters as suggested by BalusC
    However, if you want to make your existing code work, you can call (though not appropriate) main() method of Test class from main() method of Fun class (As main() method is static object is not required to invoke this):
    Test.main(new String[]{"Hello","good bye"});Here is your code:
    class Test{
    public static void main(String args[]){
    for(int i=0;i<args.length;i++)
    System.out.println(args);
    public class Fun{
    public static void main(String args[]){
    //Test t=new Test("Hello","good bye");
    Test.main(new String[]{"Hello","good bye"});
    } Thanks,
    Mrityunjoy                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • How to pass arguments from PAPI to the process

    Can any one tell me How to pass arguments from PAPI to the process.

    The link Creating a new work item instance in a process using PAPI shows how to create instances on PAPI and pass in the variable information as they are being created.
    Provide some additional detail if you're interested in seeing how to pass in variable information using PAPI for scenarios other than instance creation.
    Dan

  • How to pass argument to the Java Plugin JVM w/o using the Control Panel?

    I want to deploy an applet to be loaded by the Java Plug In
    and fix some settings of its Java Virtual Machine.
    The JPI Control Panel offers two ways to pass arguments to the JVM,
    none satisfactory.
    1. while interactive via the Control Panel Window.
    This cannot be a solution for a deployed applet.
    or
    2. by editing the system generated file that stores
    the settings of the Plugin Control Panel, using a property
    named javaplugin.jre.params.
    The problem with this method is that if forces to access
    and edit this property file which is stored at various locations
    depending the client platform. Then, it may collide with other
    settings for other applets.
    Is there a way to pass the arguments to the JVM
    from within the html file?
    Has anyone found a solution to this question?
    JPS

    I am interested in this issue as well.
    Did anyone find a reliable way to specify the runtime parameters that should be used by the Java Plug-in in order to execute a given Java applet?
    I believe a good place to specify these runtime parameters would be the applet's JAR manifest: only digitally signed applets should be able to set the desired runtime parameters...
    Any comments / suggestion would be greatly appreciated.
    Regards,
    Marco.

  • How to pass parameters to configuration files

    Hello,
    I have an application which uses several libraries and frameworks like log4j and hibernate.
    Each library/framework is configured via its own configuration file, some configuration files are in xml format and others are in properties format.
    Each configuration file has lots of specialized parameters that should not be exposed to the user but there are also one or two parameters that must be configured by the end user.
    For example:
    The log4j configuration file has lots of specialized parameters that the user should not see, but there is one parameter that the user must configure: the path for the application log file.
    Another example:
    The hibernate configuration file has lots of specialized parameters that the user should not see, but there is one parameter that the user musr configure: the path to the application database.
    It would be great if we can have an user-configuration-file that contains only the parameters that should be configured by the user and leave the complicated and specialized parameters in their corresponding files.
    I want to pass the properties defined in the user-configuration-file to the specialized configuration files.
    Any ideas to achieve this?
    Thanx

    Thank you very much to all for the replies.
    Ok, I can read the specialized-configuration-file into a Properties object, then read the user-configuration-file and merge the appropriate properties to get a complete Properties object.
    If the library/framework can't be configured with the Properties object, then I will need to write down the properties into a new file and tell the library/framework to load that file.
    I have used Properties objects and files before, but I don't have experience with xml configuration files.
    Is the same applicable to xml files?
    How can I load a XML files to an object and then update/add a particular property?.
    If that's possible, then: how can I write down the XML object to a new file?
    thanx
    Edited by: JoseLuis on Oct 23, 2008 11:28 AM

  • How to create a .f4m manifest files to play .FLV files

    I typically use .f4v files for my on demand playback media files, however I converted a .mov to a .flv file...  How do I create a .f4m and .m3u8 manifest file that plays .flv files?  Below is the code I normally use for the .f4m and .m3u8 files.  This works great with .f4v files.  I also included my player code.  What am I doing wrong?  The only difference is I'm using a .flv that I didn't use the f4vpp cleaner on..  That shouldn't give me the parse error I'm getting.
    022714.f4m is the name of my .f4m Flash manifest file.  Below are the contents.
    <manifest xmlns="http://ns.adobe.com/f4m/2.0">
      <baseURL>http://IPaddress/hds-vod/</baseURL>
      <media href="02-27-14-640-480.f4v.f4m" bitrate="1000"/>
      <media href="02-27-14-320-240.f4v.f4m" bitrate="450"/>
      </manifest>
    022714.m3u8 is the name of my HTML 5 manifest.  Below are the contents.
    #EXTM3U
    #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1000000
    http://IPaddress/hls-vod/02-27-14-640-480.f4v.m3u8
    #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=450000
    http://IPaddress/hls-vod/02-27-14-320-240.f4v.m3u8
    Flash multi bit rate player
    <object width="448" height="336">
    <param value="http://IPADDRESS/strobeplayer/StrobeMediaPlayback.swf" name="movie">
    <param value="src=http%3A%2F%2FIPADDRESS%2Fvod%2F022714.f4m&amp;streamType=recorded&amp;autoPlay =false" name="flashvars">
    <param value="true" name="allowFullScreen">
    <param value="always" name="allowscriptaccess">
    <param value="direct" name="wmode"><embed src="http://216.37.94.194/strobeplayer/StrobeMediaPlayback.swf" type="application/x-shockwave-flash" flashvars="src=http%3A%2F%2FIPADDRESS%2Fvod%2F022714.f4m&amp;streamType=recorded&amp;auto Play=false" wmode="direct" allowfullscreen="true" allowscriptaccess="always" height="336" width="448"></object>
    HTML5 player
    <p style="text-align: center;"><a href="http://IPaddress/vod/022714.m3u8"><img alt="" src="/portals/0/Silver-Play-Button.jpg" style="width: 150px; height: 151px;" />

    to create a file in appl server you have to use open dataset and close data set..
    see the sample code
    REPORT zanid_test MESSAGE-ID zz .
    parameters:  FULLPATH(128) obligatory lower case
                          default 'E:\usr\sap\put\file.txt'.
    *you change the appl sever path as per your config.
    DATA : BEGIN OF list_asc OCCURS 0,
            msg(300) TYPE c,
           END OF list_asc.
    start-of-selection.
    *---populating data
    list_asc-msg = 'abcdefghijkl'. "your sample data
    append list_asc.
    list_asc-msg = 'faagoaagiagig'. "your sample data
    append list_asc.
    OPEN DATASET fullpath FOR OUTPUT IN TEXT MODE.
    LOOP AT LIST_ASC.
          TRANSFER  LIST_ASC-MSG TO fullpath.
          CLEAR LIST_ASC-MSG.
    ENDLOOP.
    CLOSE DATASET fullpath.
    now if you go to appl server , you will find that file in that specified path..
    to create a directory yu can go to transaction AL11 and click the 'konfigurieren'button, you then you can specify the directory attibutes to create a directory
    and to load a file from your loacl pc to appl server you can use transaction CG3Y also, instead of the abap code.
    plz rewrad points if it helps you.

  • How to pass arguments from command-line to Point(x,y)

    Hi guys, I'm a beginner. i'm trying to figure this out 'how to pass the arguments from command-line to Point(x,y)'. See below is the code that i have written. But it appears eror. Is there anyone can help me to figure this out?
    class day5FourDPoint {
    int a = 0;
    int b = 0;
    int c = 0;
    int d = 0;
    day5FourDPoint rect(Point AB, Point CD) {
    a = AB.x;
    b = AB.y;
    c = CD.x;
    d = CD.y;
    return this;
    void printout() {
    System.out.println("Four Dimension : " + a + b + c + d);
    public static void main(String[] arguments) {
    day5FourDPoint FD = new day5FourDPoint();
    FD.rect(arguments);
    if (arguments.length > 1 & arguments.length < 4) {
    for (int i=0; i < arguments.length; i++) {
    FD=Integer.parseInt(arguments);
    FD.printout();
    }

    I don't use VBS so this is just a guess based on what I have read in this forum. I think when you are passing an 'array' to javascript it needs to be a variant data type. My guess your arguments are not making it to the javascript because it it the wrong data type.

  • How to load the original manifest file

    Hi I wrote an application. Is lanunched by webstart.
    In the original jar file is set an property like a Program-version:1.5
    after launching the application I can fread resources from "/resources/images/myimage", but I Cant read the from the manifest file.
    just 2 properties: Manifest version and oanother one.
    What can I do?

    You have right! That is one of the advantanges of saying a lot
    of things - I am regularly wrong, but the number
    of times I am right, outnumbers them!
    ( Also, when I am wrong, I get to find out..
    in public! ;)
    Image url =
    jar:http://www.theWebServer.com/file/path/myApplicatio
    n.jar!/resources/images/logo.png
    Manifest url =
    jar:file:/C:/Program%20Files/Java/jre1.6.0/lib/javaws.
    jar!/META-INF/MANIFEST.MF
    Is not the same! :-))
    It is true: The first time when I want to read the
    manifest file. And I never imagene before: I read my
    application image, and I cant read the same manifest
    :-))Good. It is not good that they are 'not the same',
    but that you are beginning to understand some
    of the traps and pitfalls, and ways to find out what
    is going wrong. That is progress.
    But if in my main static method if I call:
    Thread.currentThread().getContextClassLoader().getReso
    urce("/resources/images/logo.png")
    this URL is null !!
    Why?
    I know I should learn something about classloaders,
    but when is changed the jnlp loader to a "normal"
    classloader. when I launch only the .jar file I have
    no problems, but I need webstart! :-)I am surprised it worked from within main(),
    in a jar file - it usually would not work for loose
    classes off the local file system (but that is a
    whole other story, to do with classloaders).
    In any case, I think Caffeine0001 recently posted
    some source that should help out, here. Check out
    the source example he(/she) posted in this thread..
    http://forum.java.sun.com/thread.jspa?messageID=4510193
    It shows a way to find the actual file-system location
    of a resource (your image, in this case), from which we
    might construct an URL directly to the MANIFEST.MF
    that you actually need.
    Have a look/play with that source, and see if you
    can include it into your code, so that we can see
    where the image is being cached to.

  • How to pass arguments to a batch file from java code

    Hi
    I have a batch file (marcxml.bat) which has the following excerpt :
    @echo off
    if x==%1x goto howto
    java -cp C:\Downloads\Marcxml\marc4j.jar; C:\Downloads\Marcxml\marcxml.jar; %1 %2 %3
    goto end
    I'm calling this batch file from a java code with the following line of code:
    Process p = Runtime.getRuntime().exec("cmd /c start C:/Downloads/Marcxml/marcxml.bat");
    so ,that invokes the batch file.Till that point its ok.
    since the batch file accpets arguments(%1 %2 %3) how do i pass those arguments to the batch file from my code ...???
    %1 is a classname : for ex: gov.loc.marcxml.MARC21slim2MARC
    %2 is the name of the input file for ex : C:/Downloads/Marcxml/source.xml
    %3 is the name of the output file for ex: C:/Downloads/Marcxml/target.mrc
    could someone help me...
    if i include these parameters too along with the above line of code i.e
    Process p = Runtime.getRuntime().exec("cmd /c start C:/Downloads/Marcxml/marcxml.bat gov.loc.marcxml.MARC21slim2MARC C:\\Downloads\\Marcxml\\source.xml C:\\Downloads\\Marcxml\\target.mrc") ;
    I get the following error :
    Exception in thread main java.lang.Noclassdef foundError: c:Downloads\marcxml\source/xml
    could some one tell me if i'm doing the right way in passing the arguments to the batch file if not what is the right way??
    Message was edited by:
    justunme1

    1 - create a java class (Executer.java) for example:
    import java.lang.reflect.InvocationTargetException;
    import java.lang.reflect.Method;
    public class Executer {
         public static void main(String[] args) {
              try {
                   for (int i = 0; i < args.length; i++) {
                        System.out.println(args);
                   Class<?> c = Class.forName(args[0]);
                   Class[] argTypes = new Class[] { String[].class };
                   Method main = c.getDeclaredMethod("main", argTypes);
                   // String[] mainArgs = Arrays.copyOfRange(args, 1, args.length); //JDK 6
                   //jdk <6
                   String[] mainArgs = new String[args.length - 1];
                   for (int i = 0; i < mainArgs.length; i++) {
                        mainArgs[i] = args[i + 1];
                   main.invoke(null, (Object) mainArgs);
                   // production code should handle these exceptions more gracefully
              } catch (ClassNotFoundException x) {
                   x.printStackTrace();
              } catch (NoSuchMethodException x) {
                   x.printStackTrace();
              } catch (IllegalAccessException x) {
                   x.printStackTrace();
              } catch (InvocationTargetException x) {
                   x.printStackTrace();
              } catch (Exception e) {
                   e.printStackTrace();
    2 - create a .bat file:
    @echo off
    java -cp C:\Downloads\Marcxml\marc4j.jar; C:\Downloads\Marcxml\marcxml.jar; Executer %TARGET_CLASS% %IN_FILE% %OUT_FILE%3 - use set command to pass variable:
    Open MS-DOS, and type the following:
    set TARGET_CLASS=MyTargetClass
    set IN_FILE=in.txt
    set OUT_FILE=out.txt
    Then run your .bat file (in the same ms dos window)
    Hope that Helps

  • How to pass arguments to a java program.

    I want to pass a file name to java program while it is going to execute.
    ex: c:\>java <.class> <filename>
    so that i have to take that filename into a string. Is it possible? If it is possible please help me.
    and how can i check whether the filename argument is given or not through command line argument?

    public class Program{
    public static void main(String[] args){
    filename = args[0];
    static String filename;
    this code is working. But if I did not give filename, and I only give like this
    java Program
    Then how can i now whether the argument (args[0]) is passed or not?

  • How to pass csv data from file into DLL using TestStand

    Hi,
    We have data files which are of CSV format. Each row contains
    about 9 items of data, and have about 5 rows of this data (ie, 5
    test points) :
    eg
    TErrAdd1,UUT,UUT,STM1E,AU4/FR,PRBS23,BIT,10,60
    TErrAdd2,UUT,UUT,STM4O,AU3/UNFR,PRBS15,B1,20,60
    TErrAdd3,UUT,UUT,STM16O,AU4_16C/UNFR,PRBS9,BIT,7,60
    TErrAdd4,UUT,UUT,STM0E,AU3/UNFR,PRBS20,B2,5,60
    TErrAdd5,UUT,UUT,STM64O,AU4_4C/FR,PRBS11,B1,6,60
    What we want to do is to be able to directly pass each
    row of data to a C/C++ DLL. The DLL fn accepts this
    data as a vector of strings.
    eg.
    void DLLTestFn( vector const & configData )
    However, we can write a wrapper for the DLL as I don't
    think TestStand will know about vectors.
    We don't really want to have to hardcode individial references
    to each item of data in TestStand. Is this possible?
    Just read in a row from a data file, and sent it direct
    to the DLL?

    Hi Richardi,
    the principle is quite simple, however, you still need to use a programming language to make the initial file read.
    Once you've done this, you could have it as an array of strings, and pass this directly to a wrapper DLL, which would then pass the data into a string vector.
    Look up the examples\AccessingArrays\PassingArrayParametersToDll\AccessingArrays.seq
    to see how to do this without passing the sequence context.
    If you've read in the details into a container type structure already, then I've made an example which demonstrates this principle and what you'll need to pass it to a vector. (Similar principle can be used to fill in the container when you read the file in the first place.
    You cannot go directly to a vector, since TestStand doesn't understand them.
    Vector classes are difficult to export polymorphically from a DLL since the template class doesn't export, and needs specifically defining. This is what I'm assuming you're ultimately trying to do. (see ref :
    How to Export STL components inside and outside of a class
    I've used VIsual C++ 6 and TestStand 3.0
    Please let me know if this helps to answer your query.
    Thanks
    Sacha Emery
    National Instruments (UK)
    // it takes almost no time to rate an answer
    Attachments:
    for hannah vectors.zip ‏1619 KB

  • How to pass strings when downloading file

    Hi,
    I have a requirement to pass the below mentioned two string at the start of the file when download.
    wf_firstline =  '$$ADD ID=HTAUSRF1 BID=FKI4990016797'.
    wf_secondline = '*03000820000049900167970'.
    pls.provide me pointers how can this be done.
    Thanks.

    if it is a presentation file download,you have to append the data into the table before the data is filled
    and if it is in App.server download,you have to wcan write the strings before transferring the actual data.

  • How to pass arguments to a Unix shell script from PL/SQL?

    We want to run a Linux shell script from PL/SQL (10g). This is our code to run the script only and it works fine.
    dbms_scheduler.create_job
              job_name=>'RUN_LINUX_SCRIPT_' || v_job_name,
              job_type=>'EXECUTABLE',
              job_action=>'/vol0/FileLoadDir/Bank/DATA_FILES/spell_check.sh',
              enabled=>TRUE,
              auto_drop=>FALSE
            );Now we have a requirement to pass 2 arguments to the .sh file. In the .sh file the 2 arguments are defined as $1 and $2.
    I used this method.
    dbms_scheduler.create_job
              job_name=>'RUN_LINUX_SCRIPT_' || v_job_name,
              job_type=>'EXECUTABLE',
              job_action=>'/vol0/FileLoadDir/Bank/DATA_FILES/spell_check2.sh',
              --job_action=>'/vol0/FileLoadDir/Bank/DATA_FILES/spell_check2.sh /vol0/FileLoadDir/Bank/DATA_FILES/ebill2.fmt_form_strings_.txt /vol0/FileLoadDir/Bank/DATA_FILES/abcdefghij.txt',
              --job_action=>'#!/bin/bash spell /vol0/FileLoadDir/Bank/DATA_FILES/ebill2.fmt_form_strings_.txt > /vol0/FileLoadDir/Bank/DATA_FILES/abcde.txt',
              number_of_arguments => 2,
              enabled=>FALSE,
              auto_drop=>FALSE,
              comments => 'Testing by Channa'
          DBMS_SCHEDULER.SET_JOB_ARGUMENT_VALUE (
            job_name                => 'RUN_LINUX_SCRIPT_' || v_job_name,
            argument_position           => 1,
            argument_value          => '/vol0/FileLoadDir/Bank/DATA_FILES/ebill2.fmt_form_strings_.txt');
          DBMS_SCHEDULER.SET_JOB_ARGUMENT_VALUE (
            job_name                => 'RUN_LINUX_SCRIPT_' || v_job_name,
            argument_position       => 2,
            argument_value          => '/vol0/FileLoadDir/Bank/DATA_FILES/abcdefghij.txt');
          DBMS_SCHEDULER.enable (name => 'RUN_LINUX_SCRIPT_' || v_job_name);But I get an error saying:
    STANDARD_ERROR="/vol0/FileLoadDir/Bank/DATA_FILES/spell_check2.sh: line 4: read: `/vol0/FileLoadDir/Bank/DATA_FILES/ebill2.fmt_form_strings_.txt': not a valid identifier
    /vol0/FileLoadDir/Bank/DATA_FILES/spell_check2"

    Check this post:
    pass parameter from PL/SQL to Unix "as is"

Maybe you are looking for

  • Laptop computer frozen and trying to reboot but will not. How can I quit and restart?

    How do I restart a computer that is frozen and tries to reboot and will not do anything else? Is there a way to shut it down to restart. I thought I remember there were some keys to shut down and restart. We have disconnected the power and any extern

  • Distribute grayed out in Photoshop CS5

    Is there a reason this would be greyed out, both the toolbar icons and under layer -> distribute? As I understand it, you actually need layers selected for this to work -- but that doesn't change anything.  I've tried selecting multiple layers, I've

  • What does required files missing need to reinstall itunes mean?

    I tried to open iTunes and it said that ome files are missing and I need to re-install my iTunes. Does anyone know why it says this? and what to do to fix the problem? Besides, of course, re-intsalling iTunes.

  • Function module to get data from VARI table

    Hi All, thank you for viewing this thread. can anyone help me out in finding a function module which can get data from the VARI table? thank you

  • What is the lock server

    Hi, I was setting up atg demo application "QuincyFunds" through CIM, while creating server instances, one option was asking to create instance as lockserver. Can anybody please let me know what is that lockserver means. Thanks, gaurav agrawal