• Post Reply Bookmark Topic Watch Topic
  • New Topic

eclipse jdt compiler IProblem (getting the line number of compilation error)  RSS feed

Yahya Elyasse
Ranch Hand
Posts: 510
Eclipse IDE Google Web Toolkit Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys;

This question is for those familiar with the eclipse jdt compiler API.

what i'm trying to do is compile dynamically a java file ..i did this part fine using the intrnal.batch.Main.compile() method.

I'm now concered with an issue:
in case the compilation generates errors i need to be able to collect those errors and also the line number in java file corresponding to each error.

well after browsing the jdt API i found a class : CompilationUnit which contains a method :
obviously this returns the errors problems that i can investigate further for other infos.
but i don't know how to instantiate a CompilationUnit object with my java file so i can call the above method .
does someone has an Idea ?
is there any other way I can get the errors line numbers in java file ?

thanking you.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!