尽管所有配置都正确,我似乎得到了错误的版本号错误。可能有人可以帮助我找到我所缺少的东西。
错误:
线程“main”中的异常java.lang.UnsupportedClassVersionError:.class文件中的错误版本号 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:626) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124) at java.net.URLClassLoader.defineClass(URLClassLoader.java:260) 在java.net.URLClassLoader.access $ 100(URLClassLoader.java:56) 在java.net.URLClassLoader $ 1.run(URLClassLoader.java:195) at java.security.AccessController.doPrivileged(Native Method) 在java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at java.lang.ClassLoader.loadClass(ClassLoader.java:251) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:247) 在org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:56)
我的Unix框java版本是
java -version
java版“1.6.0_29”
Java(TM)SE运行时环境(版本1.6.0_29-b11)
Java HotSpot(TM)服务器VM(版本20.4-b02,混合模式)
我的eclipse所在的窗口是java版本
C:\ Eclipse> java -version
java版“1.6.0_29”
Java(TM)SE运行时环境(版本1.6.0_29-b11)
Java HotSpot(TM)64位服务器VM(内置20.4-b02,混合模式)
除了下面的代码之外,我没有任何源代码或jar,
package com.ac.markit.filter;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
public class XMLTransformation {
private static String TASK = null;
public static void main(String[] args) {
try {
if (args.length > 0) {
TASK = args[0];
System.out.println("TASK being filtered is " + TASK);
} else {
System.out.println("TASK NOT supplied..Exiting");
System.exit(2);
}
String TASK_VAR = TASK.replaceAll("\\.", "_");
String input_file_param = String.valueOf(TASK_VAR) + "_INPUT_FILE";
String output_file_param = String.valueOf(TASK_VAR) + "_OUTPUT_FILE";
String xsl_file_param = String.valueOf(TASK_VAR) + "_XSL_FILE";
StreamSource input = new StreamSource(System.getenv(input_file_param));
StreamSource xsl = new StreamSource(System.getenv(xsl_file_param));
StreamResult output = new StreamResult(System.getenv(output_file_param));
//TransformerFactory factory = TransformerFactory.newInstance();
TransformerFactory factory = TransformerFactory.newInstance(
"net.sf.saxon.TransformerFactoryImpl", null);
Transformer transformer = factory.newTransformer(xsl);
transformer.setOutputProperty("indent", "yes");
transformer.transform(input, output);
}
catch (TransformerException te) {
System.out.println("Transformer exception: " + te.getMessage());
}
}
}
我的启动配置是
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/MarkitFilter/src/com/ac/markit/filter/XMLTransformation.java"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="1"/>
</listAttribute>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.ac.markit.filter.XMLTransformation"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="MarkitFilter"/>
</launchConfiguration>