Question

I'm using the eclipse jdt compiler to compile java code. Class files are being generated, but the class name within them contains the prefix "src". For example, when compiling com.pkg.ClassName, the name of the generated class file is src.com.pkg.ClassName

Here's the code:

            for (Object classFileObject : compilationUnitDeclaration.scope.referenceContext.compilationResult.compiledTypes
                .values()) {
                classFiles.add((ClassFile) classFileObject);
            }

When building the project, we put all the sources under the "src" folder, but the generated class files should not contain this src as a prefix.

Était-ce utile?

La solution

Corrected it.I had an exception when setting the classpath which caused subsequently for the src folder not to be recognized correctly.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top