How to use parameter file with java

Is it possible to use a parameter file with Java, and is there any class/method to make it easy to call and use these parameter from a text file, other than scanning the whole text file manually as we can do normally with visual basic/c++, so we can call the program with the parameter file, like java testing c:\\testing.ini

If I understand you correctly, you may be looking for a properties file. This is basically a text file that contains pairs of strings in the form:
parameter1=value1
parameter2=value2
parameter3=value3
...etc.
and the values are retrieved using the java.util.Properties class - see:
http://java.sun.com/j2se/1.3/docs/api/java/util/Properties.html
Sample use://Call chis method once, to load the props file.
//props file is called "demo.properties", and is
//in a directory that is included in the classpath
    private void loadMyProperties() throws Exception
     InputStream stream = getResourceAsStream("/demo.properties");
     if(stream == null)
         throw new Exception("stream is null!");
     demoProperties = new Properties();
     demoProperties.load(stream);
     stream.close();
// Then you can retrieve properties in your code using:
String param3 = demoProperties.getProperty("parameter3");
//...etc

Similar Messages

  • How to use .keystore file with BEAweb 6?? Help

    Hi,
    Is there a way to use .keystore file with BEA Weblogic 6 or 6.1 ?
    I used keytool to create private key and public key..
    I do not know how to tell weblogic 6 to use it....
    Can this be done through the GUI or do I have to add something to the .xml
    config file for the site?
    Thanks,
    Rob

    "Bobby Digi" <[email protected]> wrote:
    Hi,
    Is there a way to use .keystore file with BEA Weblogic 6 or 6.1 ?
    I used keytool to create private key and public key..
    I do not know how to tell weblogic 6 to use it....
    Can this be done through the GUI or do I have to add something to the.xml
    config file for the site?
    Thanks,
    Rob
    nope. with 7.0 you can do that.
    >
    >

  • How to use "choose file with prompt" command?

    I need to use "choose file with prompt" command and I want give user possibility choose ONLY images (jpeg, png, gif). So, I write like this:
    choose file with prompt "Please, choose images for processing..." of type {"JPEG Image"}
    But this doesn't work! - All files (including jpegs) are dimmed, and user can't choose any....
    So, how can I filter JPEGs, PNGs and GIFs?

    I have found, that most of images on my computer has missing file_type, I don't know why..... so "type identifier of (info for (choose file))" also doesn't work properly.
    The only one way that 100% works is use Uniform Type Identifier (UTI) -- details here: http://www.huw.id.au/code/fileTypeIDs.html
    thanks.
    iMac G3, PowerBook G3 FW   Mac OS X (10.4.5)  

  • How to use MyFaces component with Java Creator 2

    Please advise for me the way to use Myfaces component with Java Creator 2. Thanks

    Apologies for the late reply, but currently what exists generally for MyFaces integration with Creator is on this blog:
    http://wiki.java.net/bin/view/Javatools/CustomComponentLibraries
    You might also want to post the same question on the nbusers alias on netbeans.org, referencing Visual Web Pack
    Regards,
    -Brad Mayer

  • How to use XDCAM files with Premier 4 Trial

    According to everything I have read, using XDCAM files with Premier 4 is easy. It just works. However, it doesn't with me.
    For starters, when I create a new project, there are no XDCAM presets, despite it stating there are in the various documents I have read.
    If I either try to import a file directly or copy it to the hard drive and then import it, I get:
    Error Message
    The importer reported a generic error
    Not very helpful.
    This is a trial version of Premier to try to establish if this product is any good. I did try to contact Adobe but they say they don't support trial users. Not very helpful. Since Adobe are obviously not very interested in selling their products, is there anyone else out there whop can answer this or should I just use Final Cut Pro instead (well if Adobe are not interested in helping a potential customer, what chance is there of being helpful once they have your money???)

    As far as I am concerned, editing XDCAM EX files with CS4 - I have yet to edit XDCAM (HD) files - is as easy as editing DV(CAM) material on my i7 Extreme machine with Vista Ultimate and 12 Gig of RAM.
    I am also pleased to report that the audio bug that beset CS3 when editing XDCAM EX files namely, audio cutting out randomly, is a thing of the past.
    The whole CS4 Suite (including Premiere) has been running very smoothly on my (beefy) machine.

  • How to use PDF files with links to other PDF Files

    How to use a PDF file with links to other PDF files that have been transferred to the same folder

    Are you using a mouse, or a trackpad on a laptop? Either way, your cursor is usually an arrow, right? And presumably it's working/moving MOST of the time, otherwise you wouldn't be able to do anything?
    For example, can you move the cursor arrow to the "Annotate" tool to click on it and go into Annotate mode? If so, can you click on the text tool? If so, does the cursor change to a crosshairs? At what point can you NOT move the cursor around the screen?
    Matt

  • How to use SRT file with MP4

    I want to use soft subtitles with video so I still have the option to play them without subtitles if I wish. How can I enable QuickTime Player to play MP4 with soft subtitles SRT extension? I can play AVI with subtitles in QuickTime (QT doesn't have codecs for AVI, duh, but I installed Perian to overcome that weakness). I can export the MP4 as AVI, but when I do, the result looks terrible. It seems QuickTime cannot correctly export MP4 to AVI. I can play MP4 with SRT subtitles in VLC Player, but the subtitles don't have decent shading to make them readable, like they do in QuickTime Player. Because of that, I want to find a solution for using MP4 with SRT in QuickTime Player. Any suggestions?

    The reason you see SRT soft subtitles in AVIs is because it's the Perian component that's drawing subtitles. QuickTime itself has no capability to read any external subtitle files. When you open up a MP4 file, Apple's own codecs kick in, and not Perian; therefore, you don't see any subtitles.
    There's not a lot you can do:
    1. You can wait for Apple to implement SRT support. I wouldn't hold my breath.
    2. You can talk to/beg/threaten the Perian developers and see what they can do. Note that this feature request is already filed in 2007 ( http://trac.perian.org/ticket/56 ), and they haven't acted on the request for three years.
    3. You can extract the video and audio tracks from the container and put it in a Perian-compatible container. MKV is the best option for this, I think. Note that you do not want to directly export your video to a new format, or to re-encode the tracks -- that will cost you quality. You need to find a program that lets you extract the MP4/AAC/whatever tracks from the container and remux them into a different container, such as MKV or AVI. If you can get Perian to handle the video, rather than Apple's default decoders, you'll get the SRT in QuickTime Player.
    4. You can use a different player. Honestly, I agree you with that most of the alternative players out there have absolutely atrocious user interfaces (I'm looking at ya, VLC). In the end, though, I just want to watch the video, and not fight with various video/audio formats.

  • How to use a proxy with java applications?

    I have a nokia 6300 type s40v3
    hello,
    I would like to know if it is possible to use a proxy of any and how ? kind with java applications.
    thank you

    Well, it works well when, into my applet, i do somethig like this:
    URL url = new URL(host);
    URLConnection connexion = url.openConnection();My applet uses proxy setting from IE6 but only if i use Java 1.4.2_08.
    With IE6 and Java 1.5.04, it doesn't work (my applet doesn't use proxy settings)
    With Firefox and Java 1.5.04, it's ok
    Have you already seen a problem like this with Java 1.5.04 ?

  • How can  I encrypt  files with java ?

    I don't want others to see the content of my file.so,i try to encrypt the file.
    but i don't know how to do .i think there may be two ways to do that .one is coding the file with some encrpytion tachniques .Another is try to add a locker to the file ,when someone try to read it ,the trigger is touched off.This trigger need you to input the password.
    These are my granted think .but i don't how to do.if you know,can you please to share with me? Thank you!

    The JCE is a cryptogrpahic framework for Java. There are numerous tutorials available on the web and a guide is avaiable at http://java.sun.com/j2se/1.4.2/docs/guide/security/jce/JCERefGuide.html .

  • How to use Thread.sleep() with Java Berkeley Base API?

    Hi,
    I have explained the weird problem about the server was too busy to response to SSH but it continued to finish to run (Server not response when inserting millions of records using Java Base API
    Even I tried to increase CachSize and renice Java program, but it did not work. So, I am thinking to set sleeping time for threads in Java Berkeley Base API (using “ps” command, there were 18 light weight processes created). My program did not implement transaction or concurrency because it simply creates (millions) databases records only. Is it possible and correct to do like this in the code:
    try{
    //do create a db record
    Thread.currentThread().sleep(1000);//sleep for 1000 ms
    catch(ItrerruptedException ie){
    Thank you for your kindly suggestion.
    Nattiya

    where can I get the help doc about use AT commands in java.
    Can you give me some code example about this. It is
    difficulty to me to write it myself.You simply have to send the characters and receive the characters via the comm extension. Here is the ITU standard command set - http://ridge.trideja.com/wireless/atcommands/v250.pdf. Various modems and other devices extend this in a number of ways, you may need to find documentation specific to your device as well. But start with the standard.

  • How to use mxf files with Premiere elements?

    Any ideas on how to use .mxf from my canon xf100 with elements? Also, I don't see a setting in the menu when I'm starting a project?

    http://www.google.com/#sclient=psy-ab&hl=en&q=convert+mxf+avi&oq=convert+mxf+avi&aq=f&aqi= g-v4&aql=&gs_l=hp.3..0i15l4.4835.9343.0.12811.15.13.0.2.2.0.168.1138.11j2.13.0...0.0.EDKQ8 U_mDpc&pbx=1&bav=on.2,or.r_gc.r_pw.,cf.osb&fp=e3a93c99a6099aba&biw=1905&bih=701

  • How to use parameter forms with run_report_object from Forms?

    Hi,
    I would like to run a rep report from Forms 9i. I have 9iAS R2 with a rep_<maschine_name> report server.
    Untill now I run reports with run_report_object and then used web_show_doc to display the PDF output. Now I have to display a parameter form first and only then can I run the report. Currently I am a bit lost and do not know how to do this? Could some one please point me to some examples or docs?
    Thanks in advance.

    [   Forms Reports Integration whitepaper  9i/10g ]
    see links below
    [    All Docs for all versions    ]
    http://otn.oracle.com/documentation/reports.html
    [     Publishing reports to web  - 10G  ]
    http://download.oracle.com/docs/html/B10314_01/toc.htm (html)
    http://download.oracle.com/docs/pdf/B10314_01.pdf (pdf)
    [   Building reports  - 10G ]
    http://download.oracle.com/docs/pdf/B10602_01.pdf (pdf)
    http://download.oracle.com/docs/html/B10602_01/toc.htm (html)
    [   Forms Reports Integration whitepaper  9i/10g ]
    9i - http://otn.oracle.com/products/forms/pdf/frm9isrw9i.pdf
    10g - http://www.oracle.com/technology/products/forms/pdf/10g/frm10gsrw10g.pdf
    http://www.oracle.com/technology/products/forms/techlisting10g.html
    ---------------------------------------------------------------------------------

  • How to use Xpath effectively with Java

    I am using Xpath for parsing a String with following syntax.This is a string suppose String xmlShopstring.
    <shopper>
                <upc>0123456789</upc>
                <desc>Planeters Peanutus</desc>
                <regprice>1.99</regprice>           
                <errorcode></errorcode>
            </shopper>In this case how can I use xpath parsing ?

    You can use classes from javax.xml, org.w3c.dom packages for performing XML operations in java.
    These APIs have very rich set of classes and methods for performing XML operations effectively.
    pravi.pravi wrote: how can I use xpath parsing?You need to parse XML String to org.w3c.dom.Document with use of following classes:
    javax.xml.parsers.DocumentBuilderFactory
    javax.xml.parsers.DocumentBuilderOnce you parse XML String to org.w3c.dom.Document you can use following classes and others for very effective XPath parsing.
    javax.xml.xpath.XPathFactory
    javax.xml.xpath.XPath
    javax.xml.xpath.XPathExpression
    javax.xml.xpath.XPathConstantsI have listed some classes which can help you to perform XPath parsing, you should also explore other classes in the API for more XML operations.
    Refer thread: http://forums.sun.com/thread.jspa?threadID=5357836
    Thanks,
    Tejas Purohit

  • How to use Crystal Report with Java - need help

    Dear everyone,
    i am completely new to Crystal report , please can anyone help me to creat a very simple Report using the Crystal report,
    the report will show some records from oracle DB.
    How can i make it by a simple example and with code please?
    do i need any JAR or Bean for Crystal report?
    thanks for your help and please don't hesitate to contact me in case of any inquiries.
    my email: [email protected]
    Thanks in advance

    I what to use Crystal report to generate report.My programe in java swing .Iam retrive table from database in Jtable .But when giving print
    command its print half screen .so that why I wantto usecrystal report
    package file2;
    import file2.choice;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.sql.*;
    import java.util.*;
    import java.awt.print.*;
    import javax.swing.table.*;
    import com.sun.java.swing.*;
    import javax.swing.JTable;
    public class cour extends JFrame implements Printable
         //Menu fileMenu;
         public static void main(String[] a)
    cour n = new cour();
    n.setVisible(true);
    public cour()
         super("Course Report");
         report();
         protected void report()
              JPanel panel = new JPanel();
         JButton printButton = new JButton("Print");
         panel.add(printButton);
         JButton exitButton = new JButton("Exit");
         panel.add(exitButton);     
         DefaultTableModel defaulttablemodel = new DefaultTableModel();
              JTable jtable = new JTable(defaulttablemodel);
              panel.add(new JScrollPane(jtable));
              String      tempname="";
              int tempcnt;
              String driver="sun.jdbc.odbc.JdbcOdbcDriver";
              String url="jdbc:odbc:regs";
              Object[] data = new Object[4];
              try
                             Class.forName(driver);                         
                             Connection connection=DriverManager.getConnection(url,"sa","");
                             Statement statement = connection.createStatement();     
                             String query = "SELECT courseid as CourseID,coursen as CourseName,cfee as Fee,coursed as Duration FROM course";
                             ResultSet rs = statement.executeQuery(query);     
                             ResultSetMetaData rmeta = rs.getMetaData();
                             int numColumns=rmeta.getColumnCount();                         
                             for(int i=1;i<=numColumns;i++)
                                  if(i<=numColumns)
                                       defaulttablemodel.addColumn(rmeta.getColumnName(i));
                             while(rs.next())
                                  for(int i=1;i<=numColumns;++i)
                                       if( i<=numColumns)
                                            tempname = rs.getString(i);
                                            tempcnt=i-1;
                                            data[tempcnt] = tempname;          
                                  defaulttablemodel.addRow(data);                              
                   catch(Exception ex)
              printButton.addActionListener(new ActionListener()
         public void actionPerformed(ActionEvent ae)
              /*if(ae.getActionCommand().equals("Print"))
              PrinterJob pj = PrinterJob.getPrinterJob();
              pj.setPrintable(cour.this);
              if (pj.printDialog())
              try
              pj.print();
              catch (PrinterException pe)
              System.out.println(pe);
    exitButton.addActionListener(new ActionListener()
         public void actionPerformed(ActionEvent ae)
              choice ch=new choice();
                   setVisible(false);
                   ch.setVisible(true);
    setContentPane(panel);
         setSize(1040,780);
    /*Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    Dimension frameSize = getSize();
    int x = (screenSize.width - frameSize.width) / 2;
    int y = (screenSize.height - frameSize.height) / 2;
    setLocation(x, y);*/
    addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent e) {
    dispose();
    System.exit(0);
    public int print(Graphics g, PageFormat pf, int pageIndex)
    if (pageIndex != 0) return NO_SUCH_PAGE;
    Graphics2D g2 = (Graphics2D)g;
    g2.translate(pf.getImageableX(), pf.getImageableY());
    getContentPane().paint(g2);
    return PAGE_EXISTS;
    }

  • How to use Enterprise Seriver with java Client

    Hello.
    I'd like to access Enterprise Services that are provided by Test Drive from Java Client.
    Access the Enterprise Services Workplace Systems [original link is broken]
    I've known how to find services and how to test a service.
    I've got .wsdl file.
    But I have no idea that I should do next.
    Let me know how to create proxy from Enterprise Service's wsdl files.
    Thanks,
    Koji.

    Hi Koji,
    You can test your webservices using the software XMLSpy. which you can download from here and its free.
    http://www.altova.com/download/xmlspy/xml_editor_enterprise.html
    Regards
    Sumit Bhutani

Maybe you are looking for

  • Bring back PDF Presentation...

    Hi for some reason in CS4 they got rid of the PDF Presentation option. I find this a amazing too. Many times when I have lots of windows open this is the easiest way to combine them in a PDF ready to send to the client. For the life of me I can't und

  • IMac G5 20" (iSight) Modem Query - Will Apple USB Work?

    Hi, I have a cable broadband connection on my iMac G5, but of course I cannot send a fax via broadband. I bought the computer for Christmas (missed the Intel Mac – sore subject) and was surprised to find no modem was included. All the magazines I had

  • Language Selection on winxp

    Hi! I have made 2 Frames . The frame1 have the main method and contain one textfield and a button. The frame2 contains only a textfied. In my windowsOS i use 2 languages english(default) and greek. When i am on frame1 and i write in english on textfi

  • Adobe reader XI on xp does not recognize wireless network

    upgrade to reader XI but can not connect to internet 'cause does not recognize access through wireless network

  • LMS 3.2: Running CSCOpx processes

    After a Device Package update, I see the following procs left running:     root  8268     1  24 15:39:15 ?           1:11 /opt/CSCOpx/objects/dmgt/dmgtd.sol     root 10304  2006   0 15:51:01 ?           0:00 /opt/CSCOpx/bin/in.tftpd -s /tftpboot casu