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!
MyClasshas nopackagestatement at the top to specify a package path, thenMyClass.classmust be directly in that “bin” directory.If your class does have a
packagestatement at the top:then the JVM will look under the “bin” directory for
my/package/MyClass.class. In other words, the.classfile 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.