LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to set paths for Linux, been trying it wont work (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-set-paths-for-linux-been-trying-it-wont-work-869284/)

killers10333 03-17-2011 07:09 PM

How to set paths for Linux, been trying it wont work
 
hey guys i have a centOS on my vps and i cant figure out how to set the paths...well more specifically it wont work when i do...im trying to run a runescape private server and i got no-ip set up on the vps, i got my server over, but i just need help executing the server.sh cause i get the error java is not recognized...ive set up jdk and jre and put paths to both of them...the paths i put are

root/Desktop/jre1.6.0_24/bin
root/Desktop/jdk1.6.0_24/bin

and it still doesnt work, and heres the even weirder thing, it worked once..but only once...after that it continues to not work (i didnt log off the vps or anything, i just tried it a second time a few minutes later and i got the error again...any please anyone help =D

blueCow 03-17-2011 10:11 PM

Couple things...

1. Why did you install JDK and JRE to the root desktop? It seems like maybe you only downloaded the source and untar'd it. If you installed java via the package manager, java should be installed in /usr/bin/java. If so, then you would be good to go as /usr/bin is likely in your $PATH.
- Question 1. How did you install Java?

2. While there is really nothing "wrong" with having a folder on your desktop in root's path, it's not normal at all and would be extremely confusing to most linux users. If you are getting something like
Code:

bash: java: command not found
then it is likely a path issue (assuming that you actually have installed it.
- Question 2. What is the output of the following command:
Code:

echo $PATH

killers10333 03-18-2011 04:39 PM

yes thats the error im getting and what i did was i went to sun.com (or whatever the java site is..dont remember for sure) and downloaded both jre and jdk then i untared it and yea... i didnt know there was a another way or a better way, im new to linux and so im used to things on my desktop but either way i can just delete the current jdk/jre and then if you would mind telling me the proper way to install? also the output for echo $PATH is

/usr/local/sbin:/usr/local/bin:/sbin/:/bin:/usr/sbin:/usr/bin:/root/bin

thats weird cause i could have sworn i set my paths o.o...whats the command to set paths?

thanks for reply

blueCow 03-18-2011 09:37 PM

Ok. If that is your error than you just downloaded the source (or maybe binaries) from Sun but they are not installed. Instead, I would recommend going down an easier route.

1. Install OpenJDK (as root)
Code:

yum install java
This will install OpenJDK and it will then be in your path. Once this is complete, you can run java from the command line to start up your server. Let me know if you have any issues. I have not run a runescape server before but I do run a few minecraft servers which are java based as well.

killers10333 03-19-2011 06:59 AM

woot it worked! thanks!!!!!
but now i have a couple problems/questions

ok so when i run it it runs but i get an error just saying error starting Infestus-x (server name)

and im guessing the reason is because i didnt make the .sh correctly from the .bat so is it possible that i could post what i have in my .bat and you can figure out what the equivilent should be for the .sh? if so thanks, heres whats in the .bat

Code:

@echo off
@title Server
cd bin
:run
java -Xms512m -Xmx512m -Xss64k -XX:NewSize=128m -XX:MaxNewSize=128m com.Server
goto run

and also what should happen when i run a .sh cause currently all it does is nothing lol...should it open in terminal or at least should something pop up?

blueCow 03-19-2011 11:45 AM

Again, I am not familiar with your specific game.
That is an absolutely ridiculous batch script. It runs one command.

Is your server in jar format? If so, do something like:

Code:

java -Xms512m -Xmx512m -Xss64k -XX:NewSize=128m -XX:MaxNewSize=128m -jar server_file.jar nogui
You would run this from the terminal and preferably in a screen session so that if you logout of the server, the game will continue running. So the whole thing would be something like:

Code:

screen
java -Xms512m -Xmx512m -Xss64k -XX:NewSize=128m -XX:MaxNewSize=128m -jar server_file.jar nogui

If you lose connection to your linux box, your game will continue to run and you can always reconnect to that screen session after you log back in with

Code:

screen -r
Take a look at the man for screen to see all the awesome things you can do with it. The basics that you will want to know is how to detach, reattach and list running sessions.

killers10333 03-19-2011 08:22 PM

ok but now i have a question..how do you check processes that are currently running, and how do you end them if you wanted?

also i got this error
Code:

Exception in thread "main" java.awt.HeadlessException:
No X11 DISPLAY variable was set, but this program performed an operation which requires
it.
        at java.applet.Applet.<init>(Applet.java:67)
        at com.Server.<init>(Server.java:46)
        at com.Server.main(Server.java:52)



All times are GMT -5. The time now is 03:58 PM.