Jump to content

  • Curse Sites
Become a Premium Member! Help
Latest News Article

[SOLVED] How do I change Linux Minecraft Server directory?


  • Please log in to reply
17 replies to this topic

#1

gunnarflax

Posted 23 January 2011 - 01:13 AM

Simply, how do I get the server to not save it's settings and content directly into my home directory and instead save it in a folder of my own choice?

e.g.
instead of:
~/
I want:
~/.minecraft_server/

So that I can keep my home directory relatively organised :iapprove:

Thank you!

Register or log in to remove.

#2

Orcworm
    Orcworm

    Ghast Hunter

  • Members
  • 2731 posts
  • Location: Britain
  • Minecraft: Orcworm

Posted 23 January 2011 - 01:22 AM

Do you mean this?

cd /home

mkdir Minecraft

cd /Minecraft
Posted Image

#3

gunnarflax

Posted 23 January 2011 - 01:25 AM

No, what I meant was: When you run the server jar-file for the first time it automatically creates all the files which is missing (ip-ban list, ops, etc.) into my home directory. I want those files to have another location. Or is this relative to from where I launch the application? Right now I launch it from the desktop :/

#4

expend
    expend

    Diamond Miner

  • Members
  • 880 posts
  • Location: Under your bedrock.

Posted 23 January 2011 - 01:27 AM

gunnarflax said:

No, what I meant was: When you run the server jar-file for the first time it automatically creates all the files which is missing (ip-ban list, ops, etc.) into my home directory. I want those files to have another location. Or is this relative to from where I launch the application? Right now I launch it from the desktop :/

Relative to the location where you launched the server file.
Toss creeper, run away.

#5

gunnarflax

Posted 23 January 2011 - 01:31 PM

expend said:

Relative to the location where you launched the server file.
No it's not. If I remove all files generated by the jar and launch it from another directory, the files: server.properties, server.log, ops.txt, banned-ips.txt, banned-players.txt, server.log.lck and the folder "world" are still automatically placed in /home/[username].

How can I change where those files are to be loaded from?

#6

PhonicUK
    PhonicUK

    Lapis Lazuli Collector

  • Members
  • 1086 posts

Posted 23 January 2011 - 02:58 PM

You can't change the location where it saves its files. "minecraft_server.jar" will always place the data it generates in the same folder as itself.

McMyAdmin WebUI for MC Servers (Windows, Linux, Mac OS)  Website - Wiki - Thread - Server List
Posted Image
http://CanIHostAMinecraftServer.com


#7

treboran
    treboran

    Tree Puncher

  • Members
  • 34 posts

Posted 23 January 2011 - 03:01 PM

PhonicUK said:

You can't change the location where it saves its files. "minecraft_server.jar" will always place the data it generates in the same folder as itself.

So what you do is create the Minecraft directory, move the jar into it and then launch.

My server runs from ~/mc, so I know it works fine.

#8

gunnarflax

Posted 23 January 2011 - 08:06 PM

Sorry, no, still doesn't work for me. I've already tried with not using a hidden directory (/home/[user]/.minecraft-server/) which I did earlier by running it from /opt/minecraft-server/ instead. Still the files are generated into the home directory. Are you sure you are running the latest beta? Anyone who has experienced the same issue?

#9

gunnarflax

Posted 24 January 2011 - 10:04 PM

bump*

#10

hexparrot
    hexparrot

    Lapis Lazuli Collector

  • Members
  • 1150 posts
  • Location: Phoenix, AZ
  • Minecraft: hexparrot

Posted 24 January 2011 - 10:41 PM

PhonicUK said:

You can't change the location where it saves its files. "minecraft_server.jar" will always place the data it generates in the same folder as itself.

Incorrect, a Minecraft server will always place its server files in the 'pwd'--present working directory the server is called from.  Here is an example, given the following location of the minecraft_server.jar

/home/user/minecraft_server.jar

$ pwd
/home/user
$ java -jar minecraft_server.jar
Will put all minecraft files in /home/user

$ pwd
/home/user/here/is/a/bunch/of/subdirs
$ java -jar /home/user/minecraft_server.jar

will put all Minecraft files in /home/user/here/is/a/bunch/of/subdirs

One minecraft_server.jar may be reused for any number of instances, and never will the minecraft_server.jar be the determinant of the location of the worlds.

Edit: though I suppose, in a sense it's debateable--My Point-of-view is strictly if executing minecraft_server.jar from the command line or a shell script, and 'clicking a jar from your desktop'--will not permit you to choose your worlds location.
Posted Image

#11

PhonicUK
    PhonicUK

    Lapis Lazuli Collector

  • Members
  • 1086 posts

Posted 25 January 2011 - 12:18 AM

Hexparrot is indeed correct, I'd forgotte n that the Minecraft server behaves that way. Normally its working directory is its own location, so in that instance it creates the stuff in the same place.

So if I had the minecraft server in /opt/minecraft and I was in /usr/local/minecraft when I ran /opt/minecraft/minecraft_server.jar, it'd create the files in /usr/local/minecraft .

McMyAdmin WebUI for MC Servers (Windows, Linux, Mac OS)  Website - Wiki - Thread - Server List
Posted Image
http://CanIHostAMinecraftServer.com


#12

gunnarflax

Posted 26 January 2011 - 02:51 PM

Thank you very much for the solution! I always ran minecraft from home since ubuntu's default terminal location is in ~ (home). When I cd into the directory prior to executing the program it all works as I want too :SSSS: Thank you!

p.s. How do I mark as solved in this forum?

#13

Orcworm
    Orcworm

    Ghast Hunter

  • Members
  • 2731 posts
  • Location: Britain
  • Minecraft: Orcworm

Posted 26 January 2011 - 03:21 PM

I think the only thing you can do is add [SOLVED] to your thread title.
Posted Image

#14

gunnarflax

Posted 27 January 2011 - 10:34 PM

Orcworm said:

I think the only thing you can do is add [SOLVED] to your thread title.
Maybe they should try and add that feature since it's one of the most effective ways of finding information in forums imo :) Thanks for the help!

#15

ToastWiz
    ToastWiz

    Tree Puncher

  • Members
  • 16 posts

Posted 11 April 2011 - 08:13 PM

Excellent! This thread helped a lot, I feel bad ass now but it's all thank to you guys. Kudo's to you guys  :SSSS:.
Posted Image

Posted Image Posted ImagePosted ImagePosted ImagePosted Image

#16

iv2b
    iv2b

    Stone Miner

  • Members
  • 70 posts

Posted 29 April 2011 - 06:38 PM

hi...it still doesn't works with me...
i do in the terminal:
pwd
and it does:
/home/ivan (/ivan is /user)
after i do:
/home/ivan/Scrivania/server
and it says:
bash: /home/ivan/Scrivania/server: is a directory
then i do:
java -jar /home/ivan/minecraft_server.jar
it launchs the server...but in /home/ivan/Scrivania/server there is nothing!  :P

any ideas?

*edit*
solved using:
cd "directory"
and then
java -jar /home/ivan/minecraft_server.jar

but thanks X)

#17

Deathslycer
  • Location: Holland
  • Minecraft: jeroenmathon

Posted 30 August 2012 - 03:11 PM

View Postiv2b, on 29 April 2011 - 06:38 PM, said:

hi...it still doesn't works with me...
i do in the terminal:
pwd
and it does:
/home/ivan (/ivan is /user)
after i do:
/home/ivan/Scrivania/server
and it says:
bash: /home/ivan/Scrivania/server: is a directory
then i do:
java -jar /home/ivan/minecraft_server.jar
it launchs the server...but in /home/ivan/Scrivania/server there is nothing!  :SSSS:

any ideas?

*edit*
solved using:
cd "directory"
and then
java -jar /home/ivan/minecraft_server.jar

but thanks X)
It worked thanks mate.
:D

#18

bbqroast
    bbqroast

    Lapis Lazuli Collector

  • Members
  • 1018 posts

Posted 31 August 2012 - 10:21 AM

For others, you should create a SH file likes this.
> nano start.sh
Then enter this:
cd (MC dir eg "/opt/server/")
java -jar minecraft_server.jar
Then hit CTRL+O to save.
Now you can just use "sh start.sh" to change the working DIR and start the server properly.
"Terminator like robots may one day rule the world, as long as they don't run Windows Vista"