我在windows中开发了一个简单的Java App,我现在想为LINUX / UNIX机器分发它。我应该如何将JRE打包到我的应用程序中,以便它可以在没有安装JRE或JDK的目标UNIX机器上运行?
答案 0 :(得分:0)
使用Java DockerFile(https://www.docker.com/)使用Docker(http://dockerfile.github.io/#/java)打包您的应用程序?
答案 1 :(得分:0)
############################################################
# Dockerfile to run a Java based Application
# Based on an Ubuntu Image
############################################################
#Set the base image to use to Ubuntu
FROM ubuntu:14.04
# Set the file maintainer (your name - the file's author)
MAINTAINER NB
# Set env variables used in this Dockerfile (add a unique prefix, such as DOCKYARD)
# Local directory with project source
#TO DO
# Install JDK and JRE
RUN apt-get update
RUN apt-get install software-properties-common -y
RUN add-apt-repository ppa:webupd8team/java -y
RUN apt-get update
RUN echo debconf shared/accepted-oracle-license-v1-1 select true | debconf- set-selections
RUN apt-get install oracle-java8-installer -y
RUN apt-get install oracle-java8-set-default
# Copy entrypoint script into the image
WORKDIR $DOCKYARD_SRC
COPY ./run.sh /
ENTRYPOINT ["/run.sh"]