Search code examples
androidideterminal-ide

Android Terminal-IDE: Solution to remote login java (Dalvik) compilation error?


I was only looking for an ssh terminal that didn't require rooting my phone when I stumbled across Terminal-IDE and I am THRILLED that I did! (More from its creator here.) It's an Android development environment designed to work on the portable computers known as "Android phones" and it includes what you might call an "accessable Linux operating system for non-rooted phones."

OK, now that you know what the platform is, the issue is that when I start the provided sshd and log into the phone remotely using ssh, I can't seem to get any of the java (Dalvik) machinery to work, while the same action typed locally works fine. A simple example is the Hello World Tutorial, wherein you run the java compiler thus:

# javac hello.java

The result from the local interface is a bright-shiny new hello.class. When done from the ssh login (running bash), it results in:

# javac hello.java
Dalvik VM unable to locate class 'com/spartacusrex/spartacuside/external/javac'
java.lang.NoClassDefFoundError: com/spartacusrex/spartacuside/external/javac
        at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: com.spartacusrex.spartacuside.external.javac
        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
        ... 1 more

Of course, one looks to environment variables...

The following are in the local environment but are either not in the remote environment or are different:

LOOP_MOUNTPOINT=/mnt/obb
ASEC_MOUNTPOINT=/mnt/asec
ANDROID_PROPERTY_WORKSPACE=9,131072
ANDROID_SOCKET_zygote=10
ANDROID_BOOTLOGO=1
BOOTCLASSPATH=/data/data/com.spartacusrex.spartacuside/files/system/classes/android.jar:/system/framework/core.jar:/system/framework/core-junit.jar:/system/framework/bouncycastle.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/framework2.jar:/system/framework/android.policy.jar:/system/framework/services.jar:/system/framework/apache-xml.jar:/system/framework/HTCDev.jar:/system/framework/HTCExtension.jar:/system/framework/com.htc.framework.jar:/system/framework/filterfw.jar:/system/framework/com.htc.android.bluetooth.jar:/system/framework/wimax.jar:/system/framework/com.orange.authentication.simcard.jar
PATH=/data/data/com.spartacusrex.spartacuside/files/bin:/data/data/com.spartacusrex.spartacuside/files/local/bin:/data/data/com.spartacusrex.spartacuside/files/android-gcc-4.4.0/bin:/data/data/com.spartacusrex.spartacuside/files/system/bin:/data/data/com.spartacusrex.spartacuside/files/system/bin/bbdir:/sbin:/vendor/bin:/system/sbin:/system/bin:/system/xbin
PWD=/data/data/com.spartacusrex.spartacuside/files/system/src/helloworld
EXTERNAL_STORAGE=/mnt/sdcard

The following are in the remote environment but are either not in the local environment or are different:

ANDROID_PROPERTY_WORKSPACE=10,32768
ANDROID_BOOTLOGO=1
USER=username
BOOTCLASSPATH=/data/data/com.spartacusrex.spartacuside/files/system/classes/android.jar:/system/framework/core.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/android.policy.jar:/system/framework/services.jar
PATH=/data/data/com.spartacusrex.spartacuside/files/bin:/data/data/com.spartacusrex.spartacuside/files/local/bin:/data/data/com.spartacusrex.spartacuside/files/android-gcc-4.4.0/bin:/data/data/com.spartacusrex.spartacuside/files/system/bin:/data/data/com.spartacusrex.spartacuside/files/system/bin/bbdir:/sbin:/system/sbin:/system/bin:/system/xbin
PS1=\[\033[01;32m\]$USER\[\e[1;31m\]\[\e[1;33m\]@\[\e[1;35m\]$HOSTNAME\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$
MKSH=/system/bin/sh
APK=/data/app/com.spartacusrex.spartacuside-1.apk
LOGNAME=username
EXTERNAL_STORAGE=/sdcard

Of course, my attention has flowed to "BOOTCLASSPATH". I'd never heard of BOOTCLASSPATH before, but it appears to be the replacement for just plain ole "CLASSPATH" we java coders are familiar with...

Proposed solutions are to be found on the code.google.com website under "issues", but none of them work.


Solution

  • The solution is to simply alter BOOTCLASSPATH to contain the same contents in the remote login as with the local one.

    Of course, "out of the box," this should not be a problem one encounters. But, Terminal-IDE is a young environment and this is just one of the growing pains.