public class Ftp4jTest {
public static void main(String[] args) {
try {
// 创建客户端
FTPClient client = new FTPClient();
// 不指定端口,则使用默认端口21
client.connect("192.168.1.123", 21);
// 用户登录
client.login("110", "110");
// 打印地址信息
System.out.println(client);
} catch (Exception e) {
e.printStackTrace();
}
}
}
运行代码报:
java.lang.UnsupportedClassVersionError: test/Ftp4jTest (Unsupported major.minor version 49.0)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:537)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
Exception in thread "main"
同时弹出窗口提示“could not find the main class. program will exit”
求大神指点一下
--------------------编程问答--------------------
jdk版本问题,保证开发环境和部署环境用的jdk版本一致
--------------------编程问答--------------------
同楼上
java.lang.UnsupportedClassVersionError: test/Ftp4jTest (Unsupported major.minor version 49.0)
版本的问题
,但是 不一定是jdk的,你看看你的ftp4j是不是不支持jdk1.4
--------------------编程问答--------------------
at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:537)
D:\>java -version
java version "1.4.2"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-b28)
Java HotSpot(TM) Client VM (build 1.4.2-b28, mixed mode)
D:\>javac -version
javac: invalid flag: -version
Usage: javac <options> <source files>
where possible options include:
-g Generate all debugging info
-g:none Generate no debugging info
-g:{lines,vars,source} Generate only some debugging info
-nowarn Generate no warnings
-verbose Output messages about what the compiler is doing
-deprecation Output source locations where deprecated APIs are us
ed
-classpath <path> Specify where to find user class files
-sourcepath <path> Specify where to find input source files
-bootclasspath <path> Override location of bootstrap class files
-extdirs <dirs> Override location of installed extensions
-d <directory> Specify where to place generated class files
-encoding <encoding> Specify character encoding used by source files
-source <release> Provide source compatibility with specified release
-target <release> Generate class files for specific VM version
-help Print a synopsis of standard options
这个是我查出来的结果
--------------------编程问答--------------------
给你一个建议吧,你去网上搜一个ftp4j的实例,运行一下,就用例子的包
--------------------编程问答--------------------
ftp4j必须是1.3的吗?,你用一个高版本的
--------------------编程问答--------------------
http://www.cnblogs.com/chinafine/articles/1935748.html