Samuel
Samuel

Reputation: 4387

Using SSH Programmatically Android

I am trying to use SSH to connect to my own server from an Android application I am working on, however I cannot for the life of me get it to work, I have tried many different things including JSch, however I cannot get this to work, every thing I try ends up with the same error:

04-14 22:06:57.329: E/AndroidRuntime(5641): FATAL EXCEPTION: main
04-14 22:06:57.329: E/AndroidRuntime(5641): java.lang.NoClassDefFoundError: com.jcraft.jsch.JSch
04-14 22:06:57.329: E/AndroidRuntime(5641):     at com.xynteq.terminal.LinuxCommandsActivity.executeRemoteCommand(LinuxCommandsActivity.java:51)
04-14 22:06:57.329: E/AndroidRuntime(5641):     at com.xynteq.terminal.LinuxCommandsActivity.onCreate(LinuxCommandsActivity.java:25)
04-14 22:06:57.329: E/AndroidRuntime(5641):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
04-14 22:06:57.329: E/AndroidRuntime(5641):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1722)
04-14 22:06:57.329: E/AndroidRuntime(5641):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1784)
04-14 22:06:57.329: E/AndroidRuntime(5641):     at android.app.ActivityThread.access$1500(ActivityThread.java:123)
04-14 22:06:57.329: E/AndroidRuntime(5641):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:939)
04-14 22:06:57.329: E/AndroidRuntime(5641):     at android.os.Handler.dispatchMessage(Handler.java:99)
04-14 22:06:57.329: E/AndroidRuntime(5641):     at android.os.Looper.loop(Looper.java:130)
04-14 22:06:57.329: E/AndroidRuntime(5641):     at android.app.ActivityThread.main(ActivityThread.java:3835)
04-14 22:06:57.329: E/AndroidRuntime(5641):     at java.lang.reflect.Method.invokeNative(Native Method)
04-14 22:06:57.329: E/AndroidRuntime(5641):     at java.lang.reflect.Method.invoke(Method.java:507)
04-14 22:06:57.329: E/AndroidRuntime(5641):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:864)
04-14 22:06:57.329: E/AndroidRuntime(5641):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:622)
04-14 22:06:57.329: E/AndroidRuntime(5641):     at dalvik.system.NativeStart.main(Native Method)

I would like to either figure out a way to get this method to work, or figure out any other way to use SSH in an Android application, and be able to execute commands

Upvotes: 1

Views: 1520

Answers (1)

Samuel
Samuel

Reputation: 4387

In Eclipse:

Project > Properties > Java Build Path > Order and Export > Check jsch and jzlib

Upvotes: 2

Related Questions