I am trying to run android sdk on a box that needs to have noexec
on /tmp
.
I could point java tmp to be another place where i can exec, but that would defeat the purpose of the police that requires noexec
in tmp. So i do not want to do that just yet.
I wanted to properly install the libs that sdk requires but my java is rusty.
When I try to run it, I get:
$ Android/Sdk/tools/android
Exception in thread "main" java.lang.UnsatisfiedLinkError: no swt-gtk-3550 or swt-gtk in swt.library.path, java.library.path or the jar file
at org.eclipse.swt.internal.Library.loadLibrary(Unknown Source)
at org.eclipse.swt.internal.Library.loadLibrary(Unknown Source)
at org.eclipse.swt.internal.C.<clinit>(Unknown Source)
at org.eclipse.swt.internal.Converter.wcsToMbcs(Unknown Source)
at org.eclipse.swt.internal.Converter.wcsToMbcs(Unknown Source)
at org.eclipse.swt.widgets.Display.<clinit>(Unknown Source)
at com.android.sdkmanager.Main.showSdkManagerWindow(Main.java:403)
at com.android.sdkmanager.Main.doAction(Main.java:391)
at com.android.sdkmanager.Main.run(Main.java:151)
at com.android.sdkmanager.Main.main(Main.java:117)
My first try to work around that was:
$ sudo aptitude install libswt-gtk-3-java...
Selecting previously unselected package libswt-gtk-3-jni.
(Reading database ... 199270 files and directories currently installed.)
Preparing to unpack .../libswt-gtk-3-jni_3.8.2-3_amd64.deb ...
Unpacking libswt-gtk-3-jni (3.8.2-3) ...
Selecting previously unselected package libswt-gtk-3-java.
Preparing to unpack .../libswt-gtk-3-java_3.8.2-3_amd64.deb ...
Unpacking libswt-gtk-3-java (3.8.2-3) ...
Setting up libswt-gtk-3-jni (3.8.2-3) ...
Setting up libswt-gtk-3-java (3.8.2-3) ...
But I still get the same error. Does that means that the program is not looking for default libs but purposely trying to use something it unpacks on /tmp? Or will java unpack a jar always in /tmp, and try to run it from there, and there is nothing I can do?
EDIT:
To clear that the noexec
is the cause. If I run the application with -Djava.io.tmpdir=Android/tmp
, then everything works. And I have the following content in the new tmp dir:
Android/tmp/
└── swtlib-64
├── libswt-gtk-3550.so
└── libswt-pi-gtk-3550.so
Edit 2:
$ ANDROID_SWT=/usr/lib/java/
$ ls $ANDROID_SWT/
swt-gtk-3.8.2.jar
$ Android/Sdk/tools/android
Exception in thread "main" java.lang.UnsatisfiedLinkError: no swt-gtk-3550 or swt-gtk in swt.library.path, java.library.path or the jar file
...same...
I believe if you change the android sdk tools folder (in /opt) to be writable by you using chown
, then the unpacking will happen within the sdk folder. You could do this by creating an 'androidsdk' group.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With