tags:

views:

22

answers:

1

Hi all,

I'm trying to create a Java Tool by using Xcode. I've already changed my build.xml to have Xcode target java 1.6 and not 1.3 so I can use generics. I'm getting no build errors and using 'javac' and 'java' in the terminal works. Now I want it to work in Xcode as well. I keep getting the following error:

Exception in thread "main" java.lang.NoClassDefFoundError: MyClass

where 'MyClass' is the class containing the main method. It probably has something to do with the classpath, which as the build.xml prescribes is "${bin}". There is a bin folder in my project folder, and it contains all the .class files needed to run the program.

If anybody could help me, it'd be great!

A: 
  • If your class MyClass has no package statement at the top to specify a package path, then MyClass.class must be directly in that "bin" directory.
  • If your class does have a package statement at the top:

    package my.package;
    

    then the JVM will look under the "bin" directory for my/package/MyClass.class. In other words, the .class file will need to be in a directory called "package" that is in a directory called "my", and that "my" directory is what should be in the "bin" directory.

Pointy