我有这个ftp上传方法:
try {
SimpleFTP ftp = new SimpleFTP();
// Connect to an FTP server on port 21.
ftp.connect("ftp.atw.hu", 21, "username", "password");
// Set binary mode.
ftp.bin();
// Change to a new working directory on the FTP server.
ftp.cwd("web");
// Upload some files.
ftp.stor(new File("/mnt/sdcard/Documents/Festivale.db"));
//ftp.stor(new File("comicbot-latest.png"));
// You can also upload from an InputStream, e.g.
// ftp.stor(new FileInputStream(new File("test.png")), "test.png");
// ftp.stor(someSocket.getInputStream(), "blah.dat");
// Quit from the FTP server.
ftp.disconnect();
} catch (IOException e) {
// Jibble.
}
我通过以下日志强行关闭:
08-27 14:26:09.037: E/AndroidRuntime(2378): FATAL EXCEPTION: main
08-27 14:26:09.037: E/AndroidRuntime(2378): java.lang.NoClassDefFoundError: org.jibble.simpleftp.SimpleFTP
08-27 14:26:09.037: E/AndroidRuntime(2378): at com.example.festivale_v2.main$8.onClick(main.java:106)
08-27 14:26:09.037: E/AndroidRuntime(2378): at android.view.View.performClick(View.java:2485)
08-27 14:26:09.037: E/AndroidRuntime(2378): at android.view.View$PerformClick.run(View.java:9080)
08-27 14:26:09.037: E/AndroidRuntime(2378): at android.os.Handler.handleCallback(Handler.java:587)
08-27 14:26:09.037: E/AndroidRuntime(2378): at android.os.Handler.dispatchMessage(Handler.java:92)
08-27 14:26:09.037: E/AndroidRuntime(2378): at android.os.Looper.loop(Looper.java:123)
08-27 14:26:09.037: E/AndroidRuntime(2378): at android.app.ActivityThread.main(ActivityThread.java:3683)
08-27 14:26:09.037: E/AndroidRuntime(2378): at java.lang.reflect.Method.invokeNative(Native Method)
08-27 14:26:09.037: E/AndroidRuntime(2378): at java.lang.reflect.Method.invoke(Method.java:507)
08-27 14:26:09.037: E/AndroidRuntime(2378): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
08-27 14:26:09.037: E/AndroidRuntime(2378): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
08-27 14:26:09.037: E/AndroidRuntime(2378): at dalvik.system.NativeStart.main(Native Method)
有人能告诉我什么是错的吗?我在手机上试了一下,导致同样的错误。它有互联网许可。
答案 0 :(得分:1)
显然无法找到SimpleFTP类。
您应该检查您的类路径(项目属性> Java构建路径):