?
Solved

Keep java session alive.

Posted on 2010-09-22
5
Medium Priority
?
554 Views
Last Modified: 2013-11-23
Hello experts,

as a hobby I'm trying to run a minecraft server (minecraft.net)

The server runs great but if I close the console the server stops.

The startup command is: java -Xmx1024M -Xms1024M -jar minecraft_server.jar nogui

I'm running ubuntu 10.04

how can I keep it running with the console closed?
0
Comment
Question by:kinetik20
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 7

Accepted Solution

by:
ziceva earned 668 total points
ID: 33740418
Two solutions:

java -Xmx1024M -Xms1024M -jar minecraft_server.jar nogui &
(add an & at the end)

OR

Install screen end run the server inside
0
 
LVL 4

Author Comment

by:kinetik20
ID: 33740445
Ziceva,

Thanks for the fast reply would I just sudo apt-get install screen ?
0
 
LVL 35

Assisted Solution

by:torimar
torimar earned 668 total points
ID: 33741204
On many servers, like Debian, "Screen" is installed as part of the default distribution. I'd expect it to be as such on Ubuntu as well, but on the other hand, running the apt-get command will not do any harm.

Once installed, screen will take a time to get used to. It basically creates virtual terminals that will continue to run when the user has logged out. The tricky bit is to navigate those virtual terminals from the real terminal.

Try to start your server with a string like this:

screen -A -m -d -S mcraft java -Xmx1024M -Xms1024M -jar minecraft_server.jar nogui

"mcraft" is a random name I chose to identify the screen, you may choose any identifier you like (and remember).
This command creates a virtual terminal called "mcraft", exits this terminal and lets it run in the background. Log out to see if it works.
To re-attach to the terminal that runs the server, use:
screen -r mcraft
This takes you to all the console output your game server might have generated. To leave it, hit:
CTRL+a d

Once inside your virtual terminal, you may want to be able to check all console output, past the usual number of lines, in case there has been a malfunction etc. Type:
CTRL+a ESC
Then scroll up and down with the arrow keys.

For more commands, like see 'man screen' or check here: http://aperiodic.net/screen/quick_reference
0
 
LVL 26

Assisted Solution

by:jar3817
jar3817 earned 664 total points
ID: 33743429
Or just use nohup... the process will go into the background and you can logout without it closing.

# nohup java -Xmx1024M -Xms1024M -jar minecraft_server.jar nogui
0
 
LVL 4

Author Closing Comment

by:kinetik20
ID: 33746865
Thanks so much everyone for your help!
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses
Course of the Month14 days, 16 hours left to enroll

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question