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.

有帮助吗?

解决方案

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

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top