HOw to create a Batch file for java application and whats the use of this ?

HI,
How to create a Batch file for java application ?
And whats the use of creating batch file ?
Thanks in advance

First of all, you're OT.
Second, you can find this everywhere in the net.
If you got a manifest declaring main class (an classpath if needed), just create a file named whatever.bat, within same directory of jar file, containing:
javaw -jar ./WhateverTheNameOfYourJarIs.jar %*By the way, assuming a Windows OS, you can just double click the jar file (no batch is needed).
Otherwise use:
javaw -cp listOfJarsAndDirectoriesSeparedBySemiColon country/company/application/package/className %*Where 'country/company/application/package/' just stands for a package path using '/' as separator instead of '.'
Don't specify the .class extension.
Javaw only works on Windows (you asked for batch, I assumed .BAT, no .sh), in Linux please use java.exe (path may be needed, Windows doesn't need it 'cause java's executables are copied to system32 folder in order to be always available, see PATH environment variable if you don't know what I'm talking about) and use ':' as classpath (cp) separator.
The '%***' tail is there in order to pass all parameters, it only works on Windows, refer to your shell docs for other OSs (something like $* may work).
This way you have a command you can call to launch your code (instead of opening NetBeans just to see your app working). You could schedule tasks on it or just call it in any command prompt (hope you know what it is 'cause there have been people in this very same forum with no clue about it, if not just hold the 'Windows button' and press 'R', then type 'cmd' and run it).
Finally add dukes and give 'hem away.
Bye.

Similar Messages

  • How to create a Batch file for java application  ?

    HI,
    How to create a Batch file for java application ?
    And whats the use of creating batch file ?
    Thanks in advance

    [http://static.springsource.org/spring-batch/]
    Assuming you want to develop a batch application rather than actually just create a .bat file ..

  • How to create a batch file for a java program?

    I have a java project in JCreator and the project is organised into packages. I have also configured JCreator to provide 2 arguments to the main method when the project is executed.
    I would want to create a batch file (.bat) for this project where the batch file can automatically use the arguments set in JCreator when the program runs.
    How do I go about creating the batch file?

    where the batch file can automatically use the arguments set in JCreatorThat all depends JCreator... can you get those arguments somehow?

  • How to create search index files for Java Pet Store

    Hi All,
    As you may know, the java pet store application uses for the search function a search index object, which itself uses the following files '_36.cfs', 'deletable', 'segments'.
    Now as I want to change the data of the database (delete some pets, and names, etc.), it does not have an effect on the search results. This is because the application uses the search index files and does not use the database for the search query.
    So can anybody help me and tell me how I can create this three files from my *.sql file, so I can search in my own data?
    Thank you very much for your help.
    Regards,
    Wolfgang

    gonso777 wrote:
    Solved:
    I had the same problem. It seems that the installer does not unzip three files where it should.
    With NetBeans (Using File Perspective) or just editing build.xml
    Netbeans: select build.xml/Run Target/Other Targets/unzipindexes: Tough it should work it fails in resolving $javaee.domaindir$ at least in my system, but it does suscessfully create a new directory named ${jee.domaindir} that includes lib/petstore/searchindex and three files: _36.cfs , deletable, segments.
    Copy those three files to your_glasshfish_path/domains/domain1/petstore/searchindex.
    Now you are done. I hope that you had a nice time while waiting two years for it to be answered. How is it that it is not answered anywhere else?
    Regards,
    Ramon Talavera
    www.sciencetechworks.comThanks. I didn't wait 2 years for this, but I just replied on a 2 year old post. I only recently tried the petstore app. I thought I needed to study lucene first to figure things out, it turns out there was an 'internal target' on the build file for this. Thanks a bunch!

  • How to create a jpg file for a desired  part of the canvas

    i hav to create a jpg file from the canvas which contains basic shapes which are drawn using methods like drawOval(),drawRectangle(). i need only a part of the canvas to be saved as a jpg file i.e for example from xpos 50-100 & ypos 200-250.i need all the portions of the shapes already drawn in that area as a jpg file..
    can anyone help me?

    import java.awt.*;
    import java.awt.event.*;
    import java.awt.image.BufferedImage;
    import java.io.*;
    import javax.imageio.ImageIO;
    public class CanvasClip extends Canvas implements ActionListener
        Rectangle clip;
        boolean showClip;
        public CanvasClip()
            clip = new Rectangle(50, 50, 150, 150);
            showClip = false;
        public void paint(Graphics g)
            super.paint(g);
            Graphics2D g2 = (Graphics2D)g;
            g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                                RenderingHints.VALUE_ANTIALIAS_ON);
            int w = getWidth();
            int h = getHeight();
            int dia = Math.min(w,h)/4;
            g2.setPaint(getBackground());
            g2.fillRect(0,0,w,h);
            g2.setPaint(Color.blue);
            g2.drawRect(w/16, h/16, w*7/8, h*7/8);
            g2.setPaint(Color.red);
            g2.fillOval(w/8, h/12, w*3/4, h*5/6);
            g2.setPaint(Color.green.darker());
            g2.fillOval(w/2-dia/2, h/2-dia/2, dia, dia);
            g2.setPaint(Color.orange);
            g2.drawLine(w/16+1, h/16+1, w*15/16-1, h*15/16-1);
            if(showClip)
                g2.setPaint(Color.magenta);
                g2.draw(clip);
        public void actionPerformed(ActionEvent e)
            Button button = (Button)e.getSource();
            String ac = button.getActionCommand();
            if(ac.equals("show"))
                showClip = !showClip;
                repaint();
            if(ac.equals("save"))
                save();
        private void save()
            int w = clip.width;
            int h = clip.height;
            BufferedImage img = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
            Graphics2D g2 = img.createGraphics();
            g2.translate(-clip.x, -clip.y);
            paint(g2);
            g2.dispose();
            String ext = "jpg";  // or "png"; "bmp" okay in j2se 1.5
            try
                ImageIO.write(img, "jpg", new File("canvasClip.jpg"));
            catch(IOException ioe)
                System.err.println("write error: " + ioe.getMessage());
        private Panel getUIPanel()
            Button show = new Button("show clip");
            Button save = new Button("save");
            show.setActionCommand("show");
            save.setActionCommand("save");
            show.addActionListener(this);
            save.addActionListener(this);
            Panel panel = new Panel();
            panel.add(show);
            panel.add(save);
            return panel;
        public static void main(String[] args)
            CanvasClip cc = new CanvasClip();
            Frame f = new Frame();
            f.addWindowListener(new WindowAdapter()
                public void windowClosing(WindowEvent e)
                    System.exit(0);
            f.add(cc);
            f.add(cc.getUIPanel(), "South");
            f.setSize(400,400);
            f.setLocation(200,200);
            f.setVisible(true);
    }

  • What is ABAP/JAVA Proxy and whats the use of it?

    Hello All,
    What is ABAP/JAVA Proxy. And why do we need to use them? I am not sure of the definitions given on help.sap.com. Thats the reason I am posting this question. Right answer will be rewarded. Thanks in advance.
    Regards,
    Farooq.

    HI Farooq
    <u><i>ABAP Proxy</i></u>
    ABAP server proxy is created for the inbound interface creted in XI's Integration repository proxy should be created in the business system for which the interface is created .
    U can reference following link :
    http://help.sap.com/saphelp_nw2004s/helpdata/en/02/265c3cf311070ae10000000a114084/frameset.htm
    Server Proxies are generated for Inbound Message Interfaces. These are used to Process the Data coming into SAP System from an external application.
    Sproxy is the transaction to generate Proxies.
    Plz refer to this blog on abap server proxies
    /people/siva.maranani/blog/2005/04/03/abap-server-proxies
    <u><i>Java Proxy</i></u>
    Java Proxoies are used to allows your java Applications ( j2ee, j2se applications )to interact directly to the Integration Server of XI without any special adapters.
    All documents are available on SDN itself .
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/7d4db211-0d01-0010-1e8e-9b07fc2113ab - How To Work with XI 3.0 Java Proxies
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/a068cf2f-0401-0010-2aa9-f5ae4b2096f9- Java Proxies and SAP XI - The Inside Story, Part 1
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/f272165e-0401-0010-b4a1-e7eb8903501d - Java Proxies and SAP XI - The Inside Story, Part 2
    Proxies help you achieve non-standard functionality for which the out of box XI adapters do not suffice. Just to give you an example, consider a system with which XI has to integrate , the only interface the system offers is a TCP / IP socket based interface. You could write a Java proxy which would interact over sockets with your target system, which is not possible with other standard adapters which are shipped with your XI installation
    You can refer demo on SDN TV, on this link
    https://www.sdn.sap.com/irj/sdn?rid=/webcontent/uuid/110ff05d-0501-0010-a19d-958247c9f798 [original link is broken]
    Cheers..
    Vasu
    <i>** Reward Points if found useful **</i>

  • How many softwares are there to create a setup file for java programs

    Hi, i am new to java
    I want to know how many softwares are there to create a setup file for java programs.
    I know one software i.e java launcher to create a setup file.
    I want to know about any other softwares are available to create a setup file for java programs.
    I created a setup file for swings program in JCreator.
    And don't think that i am wastiing ur time with this question .
    Help me regarding this topic.
    Thanks in Advance

    superstar wrote:
    I want to know how many softwares are there to create a setup file for java programs.13, no wait, 42.
    I know one software i.e java launcher to create a setup file.You should clearly identify what you think you already know.
    I want to know about any other softwares are available to create a setup file for java programs.
    I created a setup file for swings program in JCreator.Is this the one you talked before, or is this different?
    And don't think that i am wasting ur time with this question .Why should I not think that?

  • How to create the exe files for java application

    How to create the exe file for java application?
    got any software to do that?
    Thanks

    In terms of converting java applications into exe files, there are 3 schools of thought:
    1) Instead of converting it to an exe, convert it to a jar file. Jar files are more portable than exe files because they can be double-clicked on any operating system. The caveat is that a Java interpreter must be installed on the target computer for the double-clicking to work.
    http://developer.java.sun.com/developer/Books/javaprogramming/JAR/
    2) Create an exe launcher that, when double-clicked, attempts to find a Java interpreter on the local computer and launches the Java application. The exe file is still double-clickable but whether your java application runs depends on whether a Java interpretor is installed on the target computer.
    http://www.sureshotsoftware.com/exej/
    http://www.objects.com.au/products/jstart/index.jsp
    http://www.duckware.com/products/javatools.html
    http://www.ucware.com/jexec/
    http://www.rolemaker.dk/nonRoleMaker/javalauncher/
    http://www.jelude.cjb.net/
    http://thor.prohosting.com/~dfolly/java/index.html
    3) Create an exe launcher that bundles a Java interpretor. Same as above but when the exe file is double-clicked, it searches for a Java interpreter and if one is not found, it installs one on the target computer. The caveat is that the exe file would have an overhead of 10 MB in size for the interpreter.
    http://www.excelsior-usa.com/jet.html (evaluation version available)
    4) Convert the Java application into a native exe file. The caveat is that if you use Swing for your GUI, it won't be converted. Also this option is still somewhat experimental.
    Can't think of any free options right now.

  • How to create different log files for each of web applications deployed in OC4J

    Hi All,
    I am using OC4J(from Oracle) v1.0.2.2 and Windows2000. Now I want to know
    1. how to create different log files for each of my deployed web applications ?
    2. what are the advantages in running multiple instances of oc4j and in what case we should run
    multiple instances of OC4J ?
    3. how to run OC4J as Windows2000 Service rather than Windows2000 Application ?
    Thanks and Regards,
    Kumar.

    Hi Avi,
    First of all I have given a first reading to log4j and I think there will some more easy way of logging debugging messages than log4j (If you could provide me a detailed explanation of a servlet,jsp,java bean that uses log4j and how to use log4j then it will be very helpful for me). The other easy ways (if I am not using log4j) to my problem i.e creating different log files for each of web applications deployed in oc4j are
    I have created multiple instances of OC4J that are configured to run on different ports and so on each instance I have deployed a single web application . And I started the 2 oc4j instances by transferring thier error/log messages to a file. And the other way is ..
    I have download from jakarta site a package called servhelper . This servhelper is a thread that is started in a startup servlet and stopped in the destroy method of that startup servlet. So this thread will automatically capture all the system.out.println's and will print those to a file. I believe that this thread program is synchronized. So in this method I need not run multiple instances of OC4J instead each deployed web application on single instance of oc4j uses the same thread program (ofcourse a copy of thread program is put in each of the deployed web applications directories) to log messages on to different log files.
    Can you comment on my above 2 approached to logging debugging messages and a compartive explanation to LOG4J and how to use LOG4J using a simple servlet, simple jsp is appreciated ...
    Thanks and Regards,
    Ravi.

  • How to create a password file for executing psadmin command to deploy portl

    how to create a password file for executing psadmin command to deploy portlet

    What you have done is perfectly right. The password file doesn't have anything else apart from the password
    for example in your case
    $echo password > /tmp/password.txt
    However I remember that in windows install, the Application server used to wait for a user's input when a deploy was to be done for the first time. So Can you read the Release notes or the Readme file which has come with windows.
    The solution was,
    manually use asadmin command of application server to deploy some war (any webapp will do), at this time, a question will be prompted to accept a certificate. once this is done, deploy portlet should work fine!!!
    HTH

  • How to create a batch job for transaction SM13 or SM37

    How to create a batch job for transaction SM13 or SM37?
    I want to create a batch job for t-code SM13/SM37, the jobs will send a email to my inbox when the errors occurred in SM13/SM37.
    How to do this? thanks in advance.

    Hi,
    Check the link:
    http://www.sdn.sap.com/irj/sdn/index?rid=/webcontent/uuid/30237989-0901-0010-70a4-944691eb5e52 [original link is broken]
    Make sure the CCMS agent installation is in place as per the Monitoring setup guide.
    Follow the link Central auto reactions for configuring alert mails.
    Regards,
    Srikishan

  • How to create a dll file for lab view?

    Hello
       I want to create a DLL file for LabView. Can anyone help me in this issue?
    Regards
    Vivek 

    Please explain.
    Do you want to create a dll in another language (which one?) for use in LabVIEW or do you want to create a dll out of your LabVIEW code?
    LabVIEW Champion . Do more with less code and in less time .

  • How to create an inspection lot for each line item of the Purchase order?

    Hi,
    How to create an inspection lot for each line item of the Purchase order ?
    In detail if possible.

    Hi
       please check this
    [thread|Create Inspection Lot;

  • I have accidentally deleted off my Mac a preferences file for Adobe photoshop and now the program cannot initialize. I have talked to Apple and then say that if Adobe can isolate the file they can help me restore it from my time machine. How do I isolate

    I have accidentally deleted off my Mac a preferences file for Adobe photoshop and now the program cannot initialize. I have talked to Apple and then say that if Adobe can isolate the file they can help me restore it from my time machine. How do I isolate the file ?

    Do you have the path to this file and name of this file?

  • How to create a reference user for B2C application?

    Hello,
    Can somebody please tell me how to create a reference user for B2C application?
    I am trying to create a new account on the B2C site. It is giving me a null pointer exception. I have not created a reference user for B2C application.
    Is there any documentation available to explain the steps required for this?
    Thanks,
    Harsha

    Hi Harsha,
    Please lookup http://help.sap.com/saphelp_crm40sr1/helpdata/en/be/511378ab1311d4b32b0050da4cccf0/frameset.htm for more information.
    Cheers,
    Ashok.

Maybe you are looking for

  • How To Restore If You Never Bought Lion?

    After an update my screen is now grey upon start up. The trouble I have is when I "CMD R" to go into recovery it wants me to put in the email address that downloaded Lion.  Well I never downloaded Lion, it was on the installation disc (which I dont h

  • Flow process between  Do_int,Do_request,Do_Event_handler.

    hi, Iam doing BSP application based on MVC pattern. 1)I created model by using Class Bulider(se24).I created two attributes carrid ,flight.I created one search method. 2)I created two pages ,in 1st when i enterd carrid id inputfield  and press search

  • Resizing an image  with changes in quality factor

    Hello I have a requirement where in a image uploaded by the System has to create 2 new images of different sizes and changing the quality factor. The System is a web based interface with jsp as the presentation layer and application server as the mid

  • Ora-00980 creating mv over db link

    Hi, I need some help traking down a pesky ora-00980 syn tranlation no longer valid. Here is my situation. I have a view foo created in schema A that access data over a db link defined in schema A. User A can access data just fine. User A has granted

  • R12 FSG Report - Budget Setups

    Our requirement is to create a monthly and a quarterly fsg report for each cost center which will give the actual,budget, variance & variance as columns and all the budgeted accounts as rows. Right now in our current budget setup, We have only one ye