0

I seem to get the bad version number error despite having all configurations right. may be someone can help me locate what I am missing.

The error:

Exception in thread "main" java.lang.UnsupportedClassVersionError: Bad version number in .class file 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) at java.net.URLClassLoader.access$100(URLClassLoader.java:56) at java.net.URLClassLoader$1.run(URLClassLoader.java:195) at java.security.AccessController.doPrivileged(Native Method) at 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) at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:56)

my Unix box java version is

java -version

java version "1.6.0_29"

Java(TM) SE Runtime Environment (build 1.6.0_29-b11)

Java HotSpot(TM) Server VM (build 20.4-b02, mixed mode)

my windows where eclipse is has the java version

C:\Eclipse>java -version

java version "1.6.0_29"

Java(TM) SE Runtime Environment (build 1.6.0_29-b11)

Java HotSpot(TM) 64-Bit Server VM (build 20.4-b02, mixed mode)

I do not any source code or jars other than the one below,

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());
    }
}
}

My launch configuration is

<?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>
BRATVADDI
  • 199
  • 1
  • 2
  • 10
  • 2
    Please edit your question to include the exact error which you're getting. – Kenster Aug 01 '16 at 13:15
  • You're missing the most important part: the error that you're getting. – Erwin Bolwidt Aug 01 '16 at 13:21
  • Apologies. Have added the error – BRATVADDI Aug 01 '16 at 13:29
  • What JRE or Execution Environment and compiler version is your project configured to use (in Eclipse)? Keep in mind that Eclipse internally doesn't necessarily care what your command-line path sees as the Java version; Eclipse maintains it's own set of JRE/JDK configurations and uses them for project building and running. – E-Riz Aug 01 '16 at 13:39
  • in the java Compiler settings for the project, ive enabled project specific settings and have chosen 1.6. Also I dont have jres of any other version installed – BRATVADDI Aug 01 '16 at 13:49
  • Can you check the assembly code on the class file and see what version number it gives you? – Sameer Puri Aug 01 '16 at 20:43

0 Answers0