java.lang.UnsupportedClassVersionError: Bad version number in .class file error while executing run_cmdline.sh

I am using UWC to covert my Mediawiki pages into text file which I will later import it to Confluence. My Mediwiki is installed on a linux box and I am using command line to export the pages. UWC is installed on the same machine on which Mediawiki is present. The Java version is JDK 1.5.0_10. When I run the command I am getting following error:

uwc$ /bin/bash run_cmdline.sh -e conf/exporter.mediawiki.properties

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:620)

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 sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)

at java.lang.ClassLoader.loadClass(ClassLoader.java:251)

at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)

Can anyone help me out with this issue?

1 answer

1 accepted

This widget could not be displayed.

This error will be thrown when you try and load a class thats been compiled with an incompatible (usually future) version of Java.

From your question it looks like the class you're trying to run was compiled using Java 6 and you're using Java 5 to run it. Try upgrading your JVM to 6 and give it another go.

Hi Matthew,

Thanks for your reply.

I have downloaded the uwc.zip from https://studio.plugins.atlassian.com/wiki/display/UWC/Universal+Wiki+Converter and its mentioned in the documentation that any version of Java 5 or higher should be fine for the installation and running UWC. So I was wondering why it didn't work when I have JDK 1.5.0_10 installed on my m/c.

I downloaded the converter, extracted the starting point class and confirmed its been compiled without java 5 support:

$ file ./com/atlassian/uwc/ui/UWCCommandLineInterface.class
./com/atlassian/uwc/ui/UWCCommandLineInterface.class: compiled Java class data, version 50.0 (Java 1.6)

I'm going to do some investigating as to why this is the case or if its just an oversight.

Yeah, that's my bad. I've updated the doc to say it requires Java 6 now. It's not so much that we couldn't support Java 5. It's just that at this point, I'm using Java 6, and when I build the UWC and one of the dependencies (confluence remote java wrapper), I happen to be using 6. So, if you need it to support 5, and you're willing to build from source, it _should_ be possible, but you have to not only build the UWC against 5, but also the CRJW library and update the lib directory with the resulting jar.

Thanks Laura !! I am sure it will avoid confusion to others who will be using UWC.

One quick question. Do you know if we can use UWC to export only subset of Mediawiki?

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in Teamwork

What teamwork quotes inspire you?

Hey everyone! My name is Natalie and I'm an editor of the Atlassian Blog and I've got a question for you: What's your favorite quote about teamwork?  We've compiled a list here, along with...

150 views 16 7
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you