Batch & Java

Discussion in 'Plugin Development' started by ZanderMan9, Jun 4, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    ZanderMan9

    Hey, I know very little about Java. I do however, know Batch very well. My dilemma is this: I'm working on a server launcher batchfile, and I have the issue of a Java command pausing the script until the whole command is executed and Java says that it's done. For example...
    Code:
    set something="> "
    Java -jar craftbukkit.jar Xmx3G Xms3G -o true
    op Notch
    PAUSE
    Obviously this will not simply tell the server, a Java program, to op player Notch, because it waits on Java being done. So I plan on opening a separate Batch script right before running the server, and then that Batch script will tell the server what needs to be done.
    Code:
    tellserver (.bat)
    Java jar etc...
    My actual question is this: Is there a Java command (one like -jar, which can be used in a cmd prompt) which will tell a currently running program a certain thing, or will I need to ask a Java programmer to write me a class to do that and call on that class?

    I'm trying something else, hopefully it will work.
    Edit: No, it didn't work.

    Bump
    Hoping to have an answer soon, as this is effecting the release of my next version

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 30, 2016
  2. Offline

    Blocky4Programs

  3. Offline

    ZanderMan9

    Blocky4Programs I've tried
    echo TEXT >> C:\cmd.exe and get a permission denied error.
    Do I need to send it directly to the server somehow? Or, perhaps I can try echo TEXT | java -jar....
    I'll look at some of the pages you sent me in more depth.
     
  4. Offline

    Blocky4Programs

    Yes the commands you want to send to the server need to be send TO the server and not to cmd...
    Cmd is just the medium you use to send the commands and stuff like that...
    Why do you want to use batch anyway there are a lot more interesting way to do this... (windows form, shell, java,...)
     
  5. Offline

    mine-care

    The code you use at java -jar ect.. Starts up the jar file, that means tht everything done after that will be executed once server is shut... I don't think you can pass a argument thru cmd line in the executed jar...
     
  6. Offline

    Blocky4Programs

    Indeed I checked a few ideas I had but they didn't work (the piping stuff)
    You can always try to make a shell or form by yourself it isn't that hard...
    Or if you want to keep the cmd look you can choose to make a console application...
    You can do a lot more in those and I would be happy to help you...
     
Thread Status:
Not open for further replies.

Share This Page