Results 1 to 4 of 4

Thread: Batch Files

  1. #1
    HackerOfDoom is offline Member
    Join Date
    Mar 2010
    Posts
    21
    Rep Power
    0

    Default Batch Files

    Hi all, I'm wondering (and I know this can be done, I just don't have the file) if anyone knows how to make a batch file to run my java/class file in cmd. I know that my friend when he was writing one used code that looked roughly like this:
    Java Code:
    @echo off
    cmd.exe
    color 6
    java xxx.class
    Obviously this doesn't work, but does anyone know code that looks similar to this to execute the file? By the way, before I get any really condescending replies, yes, my file has the extension .bat lol.

    Thanks-

  2. #2
    collin389 is offline Senior Member
    Join Date
    Nov 2009
    Posts
    235
    Rep Power
    6

    Default

    mine works with just
    Java Code:
    java -cp ProgDir ProgName
    maybe you need the Class Path?

    Edit: Oh, nvm. You can't have the .class

  3. #3
    HackerOfDoom is offline Member
    Join Date
    Mar 2010
    Posts
    21
    Rep Power
    0

    Default

    Thanks, I finally got it to work with
    Java Code:
     @echo off
    color 6
    java -cp . progName

  4. #4
    HackerOfDoom is offline Member
    Join Date
    Mar 2010
    Posts
    21
    Rep Power
    0

    Default

    It was easier just to stick the batch file in the same directory then make it so the classpath was in the same directory of the batch. Then I just made a shortcut and stuck it on the desktop. Thanks anyway!

Similar Threads

  1. Replies: 23
    Last Post: 03-20-2010, 10:24 AM
  2. Batch Executing
    By sokolramaj in forum Advanced Java
    Replies: 1
    Last Post: 04-22-2009, 05:17 PM
  3. Replies: 1
    Last Post: 01-16-2009, 11:14 AM
  4. Batch Files in java
    By coco in forum New To Java
    Replies: 3
    Last Post: 12-05-2008, 02:30 PM
  5. Running batch files in java
    By pradeesh in forum New To Java
    Replies: 10
    Last Post: 12-04-2008, 10:26 PM

Posting Permissions

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