Using jME jars in Eclipse through Ant instead of build

I'm having an issue similar to ones like:

But my case is a little different.

Things run fine if I use the Run through the Run Dialog because that has all the sources on the classpath. But that's not the way I need it to work. I'm not going to be compiling the sources of jME into my game, I want to have the library included through classpath. But I want it to work through the Class-Path in the Manifest file, not through arguments passed through the command to run.

So I haven't been using the built in stuff to build, but I have a Ant file instead I'm using. Part of what it does is take all the jME and jME-Physics jar files, and their dependencies and copies them to the out/lib directory. Then it uses that to create a classpath for compilation and also a classpath that is inserted into the .jar file's manifest.

Here's the Ant file:

<?xml version="1.0" encoding="UTF-8"?>
<project name="InaneInteraction" default="rebuild" basedir=".">
   <loadproperties srcfile="build.prop" />
   <target name="rebuild" description="Clean compiled binaries then build the program" depends="clean,compile,release" />
   <target name="-make-libs-paths">
      <mkdir dir="${output_folder}"/>
      <mkdir dir="${library_folder}"/>
      <copy todir="${library_folder}">
         <fileset dir="../jme/target">
            <include name="**/*.jar"/>
            <exclude name="**/jmetest.jar"/>
            <exclude name="**/jmetest-*.jar"/>
         <fileset dir="../jme/lib">
             <include name="*.jar"/>
         <fileset file="../jmephysics/ant/lib/junit.jar"/>
         <fileset file="../jmephysics/release/jme-physics.jar"/>
         <fileset file="../jmephysics/impl/joode/lib/joode.jar"/>
         <fileset file="../jmephysics/impl/ode/lib/odejava-jni.jar"/>
      <path id="classpath">
         <pathelement path="${project.jdk.classpath}" />
         <fileset dir="${library_folder}" id="libslist">
            <include name="*.jar"/>
      <pathconvert property="buildclasspath" dirsep="/" refid="libslist">
         <mapper type="regexp" from=".*(lib.*)" to="out/1" />
      <pathconvert property="jarclasspath" pathsep=" " dirsep="/" refid="libslist">
         <mapper type="regexp" from=".*(lib.*)" to="out/1" />
   <target name="compile" description="Compile the source" depends="-make-libs-paths">
      <mkdir dir="${binary_folder}"/>
   <target name="release" description="Create a jar from binaries and import needed libraries and files" depends="-make-libs-paths">
      <jar destfile="${jar_location}" basedir="${binary_folder}">
         <fileset dir="${binary_folder}">
             <include name="**/*.class"/>
            <attribute name="Built-By" value="${built_by}"/>
            <attribute name="Main-Class" value="${main_class}"/>
            <attribute name="Class-Path" value="${jarclasspath}"/>
   <target name="run" description="Run the program from the jar">
      <java fork="true" dir="${output_folder}" jar="${jar_location}"></java>
   <target name="clean" description="Cleanup compiled binaries, libraries, media, and archives">
      <delete dir="${binary_folder}"/>
      <delete dir="${output_folder}"/>

And build.prop:


built_by=Daniel Friesen
project_name=Inane Interaction

The build output:

Buildfile: C:cygwinhomeDanielideworkspaceInaneInteractionbuild.xml
   [delete] Deleting directory C:cygwinhomeDanielideworkspaceInaneInteractionout
    [mkdir] Created dir: C:cygwinhomeDanielideworkspaceInaneInteractionout
    [mkdir] Created dir: C:cygwinhomeDanielideworkspaceInaneInteractionoutlib
     [copy] Copying 22 files to C:cygwinhomeDanielideworkspaceInaneInteractionoutlib
    [mkdir] Created dir: C:cygwinhomeDanielideworkspaceInaneInteractionbin
    [javac] Compiling 3 source files to C:cygwinhomeDanielideworkspaceInaneInteractionbin
      [jar] Building jar: C:cygwinhomeDanielideworkspaceInaneInteractionoutInaneInteraction.jar
     [java] java.lang.NoClassDefFoundError: com/jmex/game/state/GameState
     [java] Exception in thread "main"
     [java] Java Result: 1
Total time: 10 seconds

And just for more information:
The lib directory after building contains:

  • jinput.jar

  • jme.jar

  • jme-audio.jar

  • jme-awt.jar

  • jme-collada.jar

  • jme-editors.jar

  • jme-effects.jar

  • jme-font.jar

  • jme-gamestates.jar

  • jme-model.jar

  • jme-physics.jar

  • jme-scene.jar

  • jme-terrain.jar

  • jme-xml.jar

  • jogg-0.0.7.jar

  • joode.jar

  • jorbis-0.0.15.jar

  • junit.jar

  • junit-4.1.jar

  • lwjgl_util_applet.jar

  • lwjgl.jar

  • odejava-jni.jar

And this is the MANIFEST.MF that ends up inside of the .jar:
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.7.0
Created-By: 1.6.0_02-b06 (Sun Microsystems Inc.)
Built-By: Daniel Friesen
Class-Path: out/lib/jinput.jar out/lib/jme-audio.jar out/lib/jme-awt.j
 ar out/lib/jme-collada.jar out/lib/jme-editors.jar out/lib/jme-effect
 s.jar out/lib/jme-font.jar out/lib/jme-gamestates.jar out/lib/jme-mod
 el.jar out/lib/jme-physics.jar out/lib/jme-scene.jar out/lib/jme-terr
 ain.jar out/lib/jme-xml.jar out/lib/jme.jar out/lib/jogg-0.0.7.jar ou
 t/lib/joode.jar out/lib/jorbis-0.0.15.jar out/lib/junit-4.1.jar out/l
 ib/junit.jar out/lib/lwjgl.jar out/lib/lwjgl_util_applet.jar out/lib/

And trying to run it from command line gives me this:

C:cygwinhomeDanielideworkspaceInaneInteractionout>java -jar InaneInteract
Exception in thread "main" java.lang.UnsupportedClassVersionError: Bad version n
umber in .class file
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(
        at Method)
        at java.lang.ClassLoader.loadClass(
        at sun.misc.Launcher$AppClassLoader.loadClass(
        at java.lang.ClassLoader.loadClass(
        at java.lang.ClassLoader.loadClassInternal(

I guess I'm probably missing something, but I don't know what kind of other things I need to have ant include, and where/how to include them.