title: JAVA_HOME in Docker Container
body: <p>I am trying to setup a Dockerfile so that it has instructions to setup JAVA_HOME environment variable setup in the container when it starts. Then it install my node application. I need the Java environment for the xsd-schema-validator library. The library needs JAVA_HOME environment set in the container. This is what I have:</p>
  
  <pre><code>FROM openjdk:9
  
  ENV JAVA_HOME  /usr/lib/jvm
  RUN export JAVA_HOME
  
  RUN echo $JAVA_HOME
  
  FROM collinestes/docker-node-oracle:latest
  
  # Create app directory
  WORKDIR /usr/src/app
  
  COPY package*.json ./
  
  RUN npm install
  
  COPY . .
  RUN npm run build
  
  RUN npm run package
  
  # Bundle app source
  COPY . ./build
  
  CMD [ "node", "bundle-app.js" ]
  </code></pre>
  
  <p>The node app seems to start up fine. I dont see any errors when docker container starts. However when I invoke the application it crashes with error <strong>javaError: spawn javac ENOENT</strong></p>
  
  <p>I think that is because the container does not have the JAVA_HOME variable set. I have done <code>docker exec -i -t container bash</code> and tried command  <code>echo $JAVA_HOME</code> and it does not show the java executable. Additionally the java and javac commands do not work.</p>
  
  <p>Does anyone know what I am doing wrong? Any help would be appreciated. Thanks in advance!</p>