Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

run .jar file with "java" command Centos

Tags:

java

jar

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 yum command but not sure that that will exist for java?

like image 285
Jorre Avatar asked Jul 12 '26 23:07

Jorre


2 Answers

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.

like image 185
Bill the Lizard Avatar answered Jul 14 '26 12:07

Bill the Lizard


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
like image 20
Lukasz Stelmach Avatar answered Jul 14 '26 14:07

Lukasz Stelmach