简体   繁体   English

在Linux服务器上安装Java

[英]installing java on a linux server

completely new to this so apologise for the question. 对此完全陌生,因此对这个问题表示歉意。

I have current been asked to deploy a jar on a linux server at work. 目前,有人要求我在工作中的Linux服务器上部署jar。 I have sucessfully logged into ther server using ssh and transferred my jar on to it. 我已成功使用ssh登录到该服务器,并将我的jar转移到了该服务器。 However when I run any java command it says command not found. 但是,当我运行任何Java命令时,都说找不到命令。

I ran 我跑了

locate java 定位java

and

locate jar

which both return, so im guessing java is installed? 两者都返回,所以我猜java已安装? What do i need to do? 我需要做什么?

Thanks in advance 提前致谢

It sounds like your path has not been set up to fit your Java needs. 听起来您的路径尚未满足您的Java需求。 You can do either of two things: 您可以执行以下两项操作之一:

  1. Type out the full path of where java is located, and use this full path instead of "java". 键入java所在位置的完整路径,并使用该完整路径代替“ java”。
  2. Edit your PATH to include java. 编辑您的PATH以包括Java。 Here's some information on how this is done: http://www.java.com/en/download/help/path.xml 以下是有关如何完成此操作的一些信息: http : //www.java.com/en/download/help/path.xml

I think you have to check to make sure that java is installed and the path for it is set too. 我认为您必须检查以确保已安装java并设置了它的路径。

Whe you type locate jar it's most likely going to return any other jar including the one you have just added. 当您键入locate jar ,最有可能返回其他所有jar,包括刚添加的jar。 To know if java is installed, you should instead use the following command java , if the result is something like the program cannot be found... then it means there is not java. 要知道是否安装了Java,您应该改用以下命令java ,如果结果类似于the program cannot be found...则表示没有Java。 You could also use java -version which will also tell you which version is installed. 您还可以使用java -version来告诉您安装了哪个版本。 If it's for running purposes then you will be good with that. 如果它用于运行目的,那么您会很好的。

First try the command which java, it would show you if you have java installed if not download it and install,run it. 首先尝试使用java命令,如果没有下载并安装并运行它,它将显示是否安装了Java。 Then you can run the jar file as per you requirement. 然后,您可以根据需要运行jar文件。 This link shows you how to install and configure java. 该链接显示了如何安装和配置Java。

http://www.java.com/en/download/help/linux_install.xml http://www.java.com/en/download/help/linux_install.xml

Thanks & Regards, 感谢和问候,
Alok Thaker 阿洛·萨克(Alok Thaker)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM