Results 1 to 3 of 3
  1. #1
    emosms is offline Member
    Join Date
    May 2010
    Posts
    29
    Rep Power
    0

    Default start/compile java from .bat batch file

    Hi,

    I created the following .bat file

    Java Code:
    cmd
    javac divide.java
    java divide
    The divide.java file is located into the same directory as the .bat file.
    But it doesn't compile nor it execute the java file, I just get the cmd open, the working directory set, but I still have to type manualy:

    javac divide.java
    and java divide and then it works
    The point is to easy and fast compile and run java code from command line, not using IDE, for an educational purpose

    So, what is the problem here?

    Best Regards
    Last edited by emosms; 03-23-2011 at 04:03 PM.

  2. #2
    Join Date
    Mar 2011
    Posts
    98
    Rep Power
    0

    Default

    I think maybe the cmd window is disappearing on you. Modify your batch file:
    Java Code:
    javac divide.java
    java divide
    [B]pause[/B]
    ..and try again.

  3. #3
    emosms is offline Member
    Join Date
    May 2010
    Posts
    29
    Rep Power
    0

    Default

    Pause is good :)
    Tought that calling cmd first will keep the window open until it shows the result of the java file, but it actually kind of hinders it.
    So now works, thanks
    Maybe I should better first learn to basic script win and linux shell before OO programming :)

Similar Threads

  1. Help with .bat batch file problem
    By Java_Mad in forum New To Java
    Replies: 2
    Last Post: 11-03-2010, 01:52 PM
  2. Batch file to Run Java application
    By nitishlnt in forum Eclipse
    Replies: 1
    Last Post: 10-24-2008, 07:46 PM
  3. eclipse batch file
    By doug99 in forum Eclipse
    Replies: 6
    Last Post: 04-24-2008, 02:59 PM
  4. Help with Java Compile File
    By baltimore in forum New To Java
    Replies: 1
    Last Post: 08-06-2007, 07:48 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •