开发者

how to run jar file on RHEL5?

开发者 https://www.devze.com 2023-02-08 02:19 出处:网络
I have made a jar file which i tested in windows and it works fine. now i want to test it for red hat enterprise linux 5. but i dont know how to run jar files in rhel5.

I have made a jar file which i tested in windows and it works fine. now i want to test it for red hat enterprise linux 5. but i dont know how to run jar files in rhel5.

i've tried java -jar My.jar but it says bash: java: command not found. i've set JAVA_HOME variable as export JAVA_HOME=/root/jdk1.6.0_21 but still not working.

can anybody tell me how to run jar file开发者_如何转开发 in rhel5?


You need to set PATH variable , something like

export PATH=$PATH:/usr/java/jdk1.5.0_07/bin

replace /usr/java/jdk1.5.0_07/bin with path to your jdk's bin directory.

The problem is your terminal tries to find java command from the PATH , but it couldn't find it.

Update:

You need to setup global config in /etc/profile OR /etc/bash.bashrc file for all users:

# vi /etc/profile

Next setup PATH / JAVA_PATH variables as follows:

export PATH=$PATH:/usr/java/jdk1.5.0_07/bin
export PATH=$PATH:/usr/java/jdk1.5.0_07/bin


Top tip but slightly off topic.

1) Install your JDK in /usr/local/jdkX.X.X_XX/
2) Create a symbolic link /usr/local/java -> your chosen JDK installation

When you install new versions of java or if you want to revert to an older version, just change the symbolic link.

0

精彩评论

暂无评论...
验证码 换一张
取 消