简体   繁体   中英

how to set JAVA_HOME on my docker-ubuntu environment?

I'm trying ubuntu inside my mac docker environment for development. javac/gcc works fine, but when I try to use JNI to connect java and c program, I found a problem. I need to find the include file and libjvm.so file on my ubuntu docker image. But unfortunately I found the javac is actually:

root@4968756a1edd:~/mynet/mytest/build/jni# javac -version
javac 1.8.0_191

root@4968756a1edd:~/mynet/mytest/build/jni# ls -lrt `which javac`
lrwxrwxrwx 1 root root 23 Feb  6 07:38 /usr/bin/javac -> 
/etc/alternatives/javac

Well, in an ubuntu/centos VM installation, usually there's a directory for a jdk and everything (bin/lib/include) is under this directory. But in docker image, how can I find this jdk installation location and all those headers/libraries?

In bash you can set env variables like this:

sudo -H gedit /etc/environment
JAVA_HOME=/path/to/java/folder

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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