使Docker Container支持運行SWT程序

1, 下載安裝JDK的docker container java

我是從這個源下載已經作好的JDK8的container: linux

https://registry.hub.docker.com/u/dockerfile/java/ docker

docker run -it --rm dockerfile/java:oracle-java8 ubuntu

 

2, 添加GUI支持 oracle

有好幾種方案,我使用的是這種: app

http://fabiorehm.com/blog/2014/09/11/running-gui-apps-with-docker/ eclipse

還有一種是: ui

https://pelle.io/2014/07/11/delivering-gui-applications-with-docker/ blog

我沒有試過。 ip

 

3,安裝swt-gtk

可是這時候運行swt程序,仍是會拋以下錯誤:

java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons: no swt-gtk-3740 in java.library.path no swt-gtk in java.library.path Can't load library: /home/gabriel/.swt/lib/linux/x86_64/libswt-gtk-3740.so

Can't load library: /home/gabriel/.swt/lib/linux/x86_64/libswt-gtk.so

須要:

1) 添加architecture i386

sudo dpkg --add-architecture i386

sudo apt-get update

參考:

http://askubuntu.com/questions/463457/how-to-find-packages-when-updating-ubuntu-and-creating-standard-source-list-file

http://askubuntu.com/questions/551840/unable-to-locate-package-libc6-dbgi386-in-docker

 

2)安裝gtk

sudo apt-get install libgtk2.0-0:i386

參考:

http://askubuntu.com/questions/232691/cannot-open-shared-object-file-no-such-file-or-directory

 

3)安裝swt支持

sudo apt-get install libswt-gtk-3-jni libswt-gtk-3-java

並拷貝到

sudo cp /usr/lib/jni/libswt-*3740.so ~/.swt/lib/linux/x86_64/

參考http://askubuntu.com/questions/125150/unsatisfied-link-error-and-missing-so-files-when-starting-eclipse

相關文章
相關標籤/搜索