haoyangw / terminal-ide

Automatically exported from code.google.com/p/terminal-ide
0 stars 0 forks source link

Can not call javac from ssh client, but can run javac on the device. #14

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. sshd start
2. ssh login use command from help
3. run javac

What is the expected output? What do you see instead?
It should print javac usage.I got error messages
java.lang.SecurityException: /data/app/com.spartacusrex.spartacuside-2.apk 
failed verification of META-INF/SPARTACU.SF
    at java.util.jar.JarVerifier.failedVerification(JarVerifier.java:135)
    at java.util.jar.JarVerifier.verifyCertificate(JarVerifier.java:312)
    at java.util.jar.JarVerifier.readCertificates(JarVerifier.java:265)
    at java.util.jar.JarFile.getInputStream(JarFile.java:389)
    at org.apache.harmony.luni.internal.net.www.protocol.jar.JarURLConnectionImpl.getInputStream(JarURLConnectionImpl.java:239)
    at java.net.URL.openStream(URL.java:645)
    at java.lang.ClassLoader.getResourceAsStream(ClassLoader.java:486)
    at java.util.ResourceBundle$2.run(ResourceBundle.java:553)
    at java.util.ResourceBundle$2.run(ResourceBundle.java:551)
    at java.security.AccessController.doPrivileged(AccessController.java:116)
    at java.security.AccessController.doPrivileged(AccessController.java:85)
    at java.util.ResourceBundle.handleGetBundle(ResourceBundle.java:550)
    at java.util.ResourceBundle.handleGetBundle(ResourceBundle.java:588)
    at java.util.ResourceBundle.handleGetBundle(ResourceBundle.java:588)
    at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:422)
    at java.util.ResourceBundle.getBundle(ResourceBundle.java:133)
    at com.sun.tools.javac.main.JavaCompiler.version(JavaCompiler.java:112)
    at com.sun.tools.javac.main.JavaCompiler.version(JavaCompiler.java:97)
    at com.sun.tools.javac.main.Main.bugMessage(Main.java:434)
    at com.sun.tools.javac.main.Main.compile(Main.java:421)
    at com.sun.tools.javac.main.Main.compile(Main.java:308)
    at com.sun.tools.javac.main.Main.compile(Main.java:299)
    at com.sun.tools.javac.Main.compile(Main.java:82)
    at com.spartacusrex.spartacuside.external.javac.main(javac.java:13)
    at dalvik.system.NativeStart.main(Native Method)

What version of the product are you using? On what operating system?
1.92 
My Phone is Sony Ericsson MT15i

Original issue reported on code.google.com by chunlinyao@gmail.com on 7 Jan 2012 at 5:58

GoogleCodeExporter commented 9 years ago
The reason is when I ssh login the BOOTCLASSPATH is different

This is ssh login 
BOOTCLASSPATH=/data/data/com.spartacusrex.spartacuside/files/system/classes/andr
oid.jar:/system/framework/core.jar:/system/framework/ext.jar:/system/framework/f
ramework.jar:/system/framework/android.policy.jar:/system/framework/services.jar

THE WORK AROUND
export BOOTCLASSPATH=$BOOTCLASSPATH:/system/framework/bouncycastle.jar

Maybe you can figure out why it is different.

This is login to the device terminal, There is sitll a core-junit.jar which is 
not in the ssh login CLASSPATH

BOOTCLASSPATH=/data/data/com.spartacusrex.spartacuside/files/system/classes/andr
oid.jar:/system/framework/core.jar:/system/framework/bouncycastle.jar:/system/fr
amework/ext.jar:/system/framework/framework.jar:/system/framework/android.policy
.jar:/system/framework/services.jar:/system/framework/core-junit.jar

Original comment by chunlinyao@gmail.com on 7 Jan 2012 at 7:32

GoogleCodeExporter commented 9 years ago
This workaround does not work for me.

I have the exact same symptoms, but the cure doesn't do it, and the error 
messages look a bit different.

And, other things don't work from a remote login, but work fine when directly 
on the phone, such as jping. 

The following is what I get when trying to compile the example hello.java:

# 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

And jping:

# jping google.com

Dalvik VM unable to locate class 'com/spartacusrex/spartacuside/external/jping'
java.lang.NoClassDefFoundError: com/spartacusrex/spartacuside/external/jping
        at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: 
com.spartacusrex.spartacuside.external.jping
        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

Original comment by areemt...@gmail.com on 4 Apr 2013 at 3:41

GoogleCodeExporter commented 9 years ago
As a P.S. to my previous comment:

A careful examination of the differences between the set of environment 
variables one gets on the phone itself versus remote login show quite a few 
differences. I have not yet figured out which ones matter.

Here are the ones on the phone that are NOT in the set from remote login, 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/andr
oid.jar:/system/framework/core.jar:/system/framework/core-junit.jar:/system/fram
ework/bouncycastle.jar:/system/framework/ext.jar:/system/framework/framework.jar
:/system/framework/framework2.jar:/system/framework/android.policy.jar:/system/f
ramework/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:/s
ystem/framework/wimax.jar:/system/framework/com.orange.authentication.simcard.ja
r
PATH=/data/data/com.spartacusrex.spartacuside/files/bin:/data/data/com.spartacus
rex.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/bi
n:/system/sbin:/system/bin:/system/xbin
PWD=/data/data/com.spartacusrex.spartacuside/files/system/src/helloworld
EXTERNAL_STORAGE=/mnt/sdcard

Here are the ones from the remote set that are NOT in the local set, or are 
different:

ANDROID_PROPERTY_WORKSPACE=10,32768
ANDROID_BOOTLOGO=1
USER=username
BOOTCLASSPATH=/data/data/com.spartacusrex.spartacuside/files/system/classes/andr
oid.jar:/system/framework/core.jar:/system/framework/ext.jar:/system/framework/f
ramework.jar:/system/framework/android.policy.jar:/system/framework/services.jar
PATH=/data/data/com.spartacusrex.spartacuside/files/bin:/data/data/com.spartacus
rex.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/sb
in:/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

Any help appreciated.

Original comment by areemt...@gmail.com on 4 Apr 2013 at 3:47