开发者

run .jar file with "java" command Centos

I'm trying to run a .jar file on my centos box, but it says "java: command not found".

What's the best or easiest way to solve this? I was hoping for a yu开发者_开发问答m command but not sure that that will exist for java?


Apparently some versions of CentOS doesn't come with a JVM installed due to some licensing restriction. See HowTo Install Java on CentOS 4 and CentOS 5 for instructions.


You can use such command to check if Java is available in your repository:

yum list | grep java

It should return something like that:

java-1.6.0-openjdk
java-1.6.0-sun

If such package exists you can install it using such command (run it as the root user):

yum install java-1.6.0-openjdk


Either the JRE is not installed or, more likely, its location is not included in your PATH environment variable. If the java executable is not in your PATH, you would need to use the full path & filename to execute it.


cd to the location of the jar file

C:\temp>java -jar sample.jar

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜