Thread: Run.bat for server not working

Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1 Run.bat for server not working 
    Registered Member
    Join Date
    Aug 2017
    Posts
    10
    Thanks given
    0
    Thanks received
    0
    Rep Power
    11
    For resetting my server using a ingame command I need an run.bat for my server but I can't get it to work, any suggestions?


    my run.bat:
    @echo off
    echo starting server
    "C:\Program Files\Java\jdk1.8.0_144\bin\java.exe" -cp bin.com.elvarg -Xms512m -Xmx624m Elvarg 10 0 highmem members 32
    pause
    Reply With Quote  
     

  2. #2  
    Registered Member excl150's Avatar
    Join Date
    Jul 2014
    Posts
    102
    Thanks given
    29
    Thanks received
    19
    Rep Power
    22
    You should consider to use an IDE. Eclipse would be a good one.
    run.bat is nerver used anymore...
    Reply With Quote  
     

  3. #3  
    Registered Member
    Join Date
    Aug 2017
    Posts
    10
    Thanks given
    0
    Thanks received
    0
    Rep Power
    11
    I am using Eclipse, I can stop the server using it but to start it up again Programmatically I need a bat
    Reply With Quote  
     

  4. #4  
    Registered Member excl150's Avatar
    Join Date
    Jul 2014
    Posts
    102
    Thanks given
    29
    Thanks received
    19
    Rep Power
    22
    Well that shouldn't be the case, you should be able to have full control over your server within eclipse.
    What error does it display when you try to start it up?
    Reply With Quote  
     

  5. #5  
    Registered Member
    Join Date
    Aug 2017
    Posts
    10
    Thanks given
    0
    Thanks received
    0
    Rep Power
    11
    Reply With Quote  
     

  6. #6  
    Registered Member excl150's Avatar
    Join Date
    Jul 2014
    Posts
    102
    Thanks given
    29
    Thanks received
    19
    Rep Power
    22
    You should launch the server from eclipse, try to find the class where it has the following included:
    Code:
    public static void main(String[] args) {
    This should be where your server will be launched from and then you have to click the big green arrow in the top bar:
    [Only registered and activated users can see links. ]
    Reply With Quote  
     

  7. #7  
    Registered Member
    Join Date
    Aug 2017
    Posts
    10
    Thanks given
    0
    Thanks received
    0
    Rep Power
    11
    The launching of the server works but i want to do it programmatically with a ::restart command in game
    this is what I came up with already, Elvarg is the main class
    Code:
    if (parts[0].equalsIgnoreCase("restart")) {
    				ShutdownHook shutdown = new ShutdownHook();
    			    shutdown.run();
    			    System.exit(1);
    			    Elvarg Server = new Elvarg();
    			    Server.main(new String[] {""});
    			}
    Reply With Quote  
     

  8. #8  
    Registered Member excl150's Avatar
    Join Date
    Jul 2014
    Posts
    102
    Thanks given
    29
    Thanks received
    19
    Rep Power
    22
    the problem is in not passing any arguments.
    Code:
    if (parts[0].equalsIgnoreCase("restart")) {
    				ShutdownHook shutdown = new ShutdownHook();
    			    shutdown.run();
    			    System.exit(1);
    			    Elvarg Server = new Elvarg();
    			    Server.main(new String[] {""});
    			}
    I would just acces it in a static way so i would do like this:
    Code:
    if (parts[0].equalsIgnoreCase("restart")) {
        ShutdownHook shutdown = new ShutdownHook();
        shutdown.run();
        try {
            Server.main(new String[] {""});
        } catch (Exception e) {
             e.printStackTrace();
        }
    }
    My server needs 5 arguments to start (you can have 0 arguments, in that case you can just leave it blank)
    Reply With Quote  
     

  9. #9  
    Registered Member
    Join Date
    Aug 2017
    Posts
    10
    Thanks given
    0
    Thanks received
    0
    Rep Power
    11
    Code:
    public static void main(String[] params) {
    the variable params is never used, can this still cause a problem?
    Reply With Quote  
     

  10. #10  
    Registered Member excl150's Avatar
    Join Date
    Jul 2014
    Posts
    102
    Thanks given
    29
    Thanks received
    19
    Rep Power
    22
    I updated my last post, but on a side note I would advise not doing this, doesn't look very safe to me.
    I think this could create a stack overflow exception if restarted enough times.. since you are dealing with threads etc.
    (i suck at programming so im not sure )
    Reply With Quote  
     

Page 1 of 2 12 LastLast

Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. help with my run.bat for my server..
    By terry baby in forum Help
    Replies: 0
    Last Post: 02-11-2012, 06:10 PM
  2. Run server not working, please help?
    By Haledam in forum Help
    Replies: 2
    Last Post: 06-29-2011, 12:23 AM
  3. Run for Client not working.
    By Lolmaster in forum Help
    Replies: 1
    Last Post: 12-17-2009, 03:22 AM
  4. Rs2d 377 server run.bat for windows
    By Streax in forum Requests
    Replies: 2
    Last Post: 12-03-2009, 01:30 AM
  5. run.bat in client fix works for everyone
    By Arvid in forum Tutorials
    Replies: 5
    Last Post: 02-22-2008, 05:03 PM
Tags for this Thread
bat

View Tag Cloud

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