score:7

Accepted answer

problem solved...it was easier then i expected...

ijavaproject javaproject = javacore.create(proj);
iclasspathentry[] entries = javaproject.getrawclasspath();

iclasspathentry[] newentries = new iclasspathentry[entries.length + 1];
system.arraycopy(entries, 0, newentries, 0, entries.length);

ipath srcpath= javaproject.getpath().append("target/generated-sources");
iclasspathentry srcentry= javacore.newsourceentry(srcpath, null);

newentries[entries.length] = javacore.newsourceentry(srcentry.getpath());
javaproject.setrawclasspath(newentries, null);

and this will add source entry to .classpath file:

score:0

try one of javacore.newsourceentry(...) methods instead of javacore.newprojectentry(...).


Related Query

More Query from same tag