jME, Eclipse, and a missing Main

I’m trying to get jME up and running on Eclipse. I followed this tutorial word for word because I’ll admit to only understanding parts of what it was asking me to do. After trying to compile some of the test code (such as the and the, I get the same error.

First, a window pops up declaring “Could not find the main class. Program will exit.”

The console reads:

java.lang.UnsupportedClassVersionError: Bad version number 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(
Exception in thread "main"

I did a search for the error and I couldn't find anyone else having similar problems. Hopefully this isn't some woefully stupid error that everyone else figured out how to solve on their own. Apologies if I'm retreading old territory and missed the old topics. Any ideas?

So far all I've tried was cleaning the project, downloading it again, and setting the Native Library Locations for everything. No luck yet.

What version of the JDK are you using?

Try going to a command-prompt and typing: java -version and see what it spits out.  You need to have JDK 1.5 or greater to compile jME.

I'm using version 1.6.0_03

What about "javac -version"?

It says "javac" is not a recognized command. Is that something I need?

Then most likely what you have is a Java Runtime Environment (JRE) while you need the Standard Development Kit (SDK) Because without it, you will not be able to compile anything.

I recommend to first get comfortable with Java before trying jME.

Well, worried that something might have happened to the Java SDK I have installed, I downloaded and reinstalled the SDK. "javac" is still not a recognized command. Any other ideas?

For the record, I have a few years experience with Java under my belt. My knowledge is mostly with using the code itself. I haven't spent much time learning compilers, how they work, or why I'm using Eclipse rather than NetBeans or some other product. I'm trying to get jME to work on my computer because I am part with a group attempting to program a simple game. The foundation of the game so far has been built with jME.

Wherever you have the JDK installed will have a bin directory that contains javac.exe. You need to configure your PATH (Windows Environment Variable) to make reference to that bin directory so that javac can be found. Further, if you create a JAVA_HOME environment variable pointing to the JDK directory (the parent to the bin directory) Eclipse should utilize it on startup and hopefully solve all your problems.

It's working now. I'm not exactly sure how or why. I still can't get the command "javac version" to do anything. What ended up fixing things was a redownload and a reinstall of the jdk. I have no idea why it worked this time and didn't work last time, but it did work, so I guess thats all I should ask for.

Thanks darkfrog and duenez for the help. I have no idea what an environment variable is (feel free to scorn, there's some things about computers that just don't stick, so it's very possible it has been explained to me before). I'll look it up on Wikipedia, see if I can configure my PATH and get that "javac version" command working. Again, thanks for the help, definitely appreciated.

It’s supposed to be “javac -version” btw.

I would recommend spending some time at: at least to re-familiarize yourself with Java. That will probably increase your productivity significantly.


I have done the Eclipse guide to JME step by step. But now I have the same problem as described above (no compilation, main class could not be found and console in eclipse says Bad version number in .class file).

I haven't done anything with jME till now, but I'm still looking forward do make a first simple game. So long, let me explain what I'm doing:

  • I use JBuilder2007 (of course build on eclpise)
  • I have JDK 1.6 and also JRE
  • I am able to compile all my Java files (which are not using jME)

    My problems so far:
  • In the Eclipse tutorial is one step I couldn't understand: Then Expand lwjgl.jar → Native Library Location → Edit → Workspace… → expand jME → select lib → OK → OK → Finish. :? :?
  • What I am supposed to do in this step (in any other words)?
  • There isn't a or in the jmetest.render or other package at all!!!
  • Do I need the jME 1.0 Jar's or is it enough to have the libs from the jME project as described in the tutorial??
  • I can't compile any of the example files. The error message is very bad:

    java.lang.UnsupportedClassVersionError: Bad version number in .class file

    I really need some help, please! :cry:

    For me this hasn't to do anything with my JDK, because I use the current up to date version and everything except jME works fine!! }:-@ }:-@


My problems so far:
- In the Eclipse tutorial is one step I couldn't understand: Then Expand lwjgl.jar → Native Library Location → Edit → Workspace... → expand jME → select lib → OK → OK → Finish. huh huh

That step is together with Step 10, at the same window.

1) Check it:

Now, everything works!! XD

Thank you very much for the detailed information in your answer.

Well done highnick.

The key that made everything running was to add the JDK 1.6 as standard-VM.

I have added the new JDK as you have described (window->preferences->installed jre's->selecting path…)

I selected the path to my JDK (C:/Program Files/Java/jdk1.6.0_04) in the "search" dialog of the installed jre's list. Then I choose the new entry from the list "jre(1)" as standard-vm by activating its checkbox.

Next, I recompiled the whole project by clicking on Project->Build all.

(The other aspect choosing the lib directory for the "Native Library Location" of the lwjgl.jar I have also done, but I don't understand why and what this affects since the buildpath already knows all jar's which are needed to compile the project)

Now, I also found an answer to my preceding question:

Do I need the jME 1.0 Jar's or is it enough to have the libs from the jME project as described in the tutorial

Of course both Jar directories are needed. jME is just a scenegraph based system which creates some abstraction layer and should give the possibility to plug in any engine. In the current situation the one and only engine to plug in is LWJGL.

So, in order to make jME running and to achieve any visualization, jME needs some engine (LWJGL). Furthermore Eclipse must use a extern JDK as standard-vm and not the standard-vm which comes with the JBuilder2007 v2 in my case.

Now I can start with some real tutorial. :) Thanks.

i had this problem the day before yesterday … it seems this problem happenend by updating from CVS, my CLASS PATH project changed my JRE selection FROM 1.6.0_05 to 1.6.0_03, and then i got the error "could not find main class project" … after deleting project and reisntalling JME suite on Eclipse, the problem was still there …

i success to solve it by selecting the new version of JRE ( 1.6.0_05 ) , then cleangin build project, and rebuild it …

if it's help … :slight_smile: