Reputation: 534
I currently run this in a .bat file:
java -jar BungeeCord.jar
Upon running the .bat file this opens and closes and does not stay open. If I manually go into CMD, cd into the folder and launch the bat file it stays open fine. What's the difference between clicking and opening the .bat file and going into cmd and opening it?
I can tell it doesn't launch as I cannot connect to it at all. I need a way to rectify this so it launches through the .bat by just clicking on it, just now it opens and closes quickly.
Upvotes: 0
Views: 1369
Reputation: 1
I hope this is helpful, I use this script:
@ECHO OFF
TITLE LOBBY SERVER
color 0b
SET BINDIR=%~dp0
CD /D "%BINDIR%"
echo ---------------------------------------------------------------------
echo STARTING UP SERVER, PLEACE WAIT...
echo ---------------------------------------------------------------------
timeout /t 5 /nobreak
:Start-Server
"%ProgramFiles(x86)%\Java\jre1.8.0_45\bin\java.exe" -Xincgc -Xmx1G -Xloggc:J:\logs\lobby.log -jar craftbukkit.jar
echo ---------------------------------------------------------------------
echo SERVER HAS CRASHED!
echo RESTARTING IN 5 SEKUNDES...
echo ---------------------------------------------------------------------
ping -n 10 127.0.0.1 > NUL
cls
GOTO Start-Server
Upvotes: 0
Reputation: 4119
This will keep the window open after the jar is finished. I'm unsure what you mean, so I'm not sure if this is what you were looking for.
cmd /k java -jar BungeeCord.jar
Upvotes: 2
Reputation: 837
If it is opening and closing immediately, the process is terminating...
What is happening exactly when you open it from command prompt? Is your jar running when this is done?
Try redirecting output to a file like below:
java -jar BungeeCord.jar > out.txt
See the content of out.txt and you can find out what could be the problem...
Upvotes: 0