• 2 replies
  • Latest Post - ‏2011-01-15T03:51:54Z by JavinPaul
1 Post

Pinned topic run java program using bat file

‏2010-12-08T04:45:52Z |
I want to run a simple hello world java ( program using a batch file. How can i run it and how to construct a batch file. kindly let me know
Updated on 2011-01-15T03:51:54Z at 2011-01-15T03:51:54Z by JavinPaul
  • SystemAdmin
    210 Posts

    Re: run java program using bat file

    Invoking java class from bat file is simple.
    Do you have basic knowledge on DOS/Windows batch file ?
    In your batch file specify the following commands
    1. add jdk bin folder to your PATH
    2. javac <your javafile>
    3. java <your class file generated from step 2>

    save this file as *.bat and execute it. if you are using any specify libraries then add it in classpath
  • JavinPaul
    1 Post

    Re: run java program using bat file


    Batch file (.bat) is nothing but a text file with .bat extension and generally we store commands on it (like shell script in unix) and when we invoke it from command prompt , DOS execute those commands. so by putting "java classname" in batch file you can invoke your program but yes its good idea to set PATH and CLASSPATH inside batch file for convinience.


    Why String is immutable in Java FIX Protocol tutorial tibco tutorial