• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

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

Ranch Hand
Posts: 510
Google Web Toolkit Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
Cob is sand, clay and sometimes straw. This tiny ad is made of cob:
the value of filler advertising in 2021
    Bookmark Topic Watch Topic
  • New Topic