[英]Spring Boot Run Jar file in linux
I have developed a Spring Boot Application using Restfull API.我已经使用 Restfull API 开发了一个 Spring Boot 应用程序。 The application working perfectly in STS.
该应用程序在 STS 中完美运行。 But now i am trying to run a jar file in linux, any idea.
但是现在我想在 linux 中运行一个 jar 文件,任何想法。
You can generate runnable jar file using 2 ways.您可以使用 2 种方式生成可运行的 jar 文件。
a.一种。 Exporting as JAR file from STS.
从 STS 导出为 JAR 文件。
Right click on project in STS --> click on Export --> search for jar --> click on JAR file --> select project --> select resource to export --> Select checkbox : Export Java source files and resources --> select the export destination --> give a name for JAR file (for example abcd.jar) click finish to generate JAR file.
在STS中右键单击项目-->点击导出-->搜索jar-->点击JAR文件-->选择项目-->选择要导出的资源-->选择复选框:导出Java源文件和资源- -> 选择导出目标 --> 为 JAR 文件命名(例如 abcd.jar)单击完成以生成 JAR 文件。
b.湾Using Maven.
使用 Maven。
First, make sure that you have the repackage goal included in your build setup , then use the Maven package target.
首先,确保您的构建设置中包含重新打包目标,然后使用 Maven 包目标。 The simplest way to do this is to run mvn package from the command line (you may need to install the Maven CLI package for your OS);
最简单的方法是从命令行运行 mvn package(你可能需要为你的操作系统安装 Maven CLI 包); you can also right-click the POM in Eclipse and "Run As" to execute specific Maven operations from within Eclipse.
您还可以在 Eclipse 中右键单击 POM 并“运行为”以从 Eclipse 中执行特定的 Maven 操作。
To run JAR file open command/terminal prompt and reach to destination where JAR file was created.要运行 JAR 文件,请打开命令/终端提示符并到达创建 JAR 文件的目的地。 then execute command java -jar abcd.jar
然后执行命令java -jar abcd.jar
Can you follow the steps你能按照步骤吗
java -version
sudo apt-get install openjdk-version-what you want JDK verson -jre
// example - sudo apt-get install openjdk-7-jre
java -jar Minecraft.jar
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.