Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #7333

Re: Using sun javac to parse java source

From Lew <lewbloch@gmail.com>
Newsgroups comp.lang.java.programmer
Subject Re: Using sun javac to parse java source
Date 2011-08-23 17:25 -0700
Organization http://groups.google.com
Message-ID <7731799a-db7a-4b5a-b885-9852338f304e@glegroupsg2000goo.googlegroups.com> (permalink)
References <66227810-c927-4197-a138-f25b54f26f7f@k8g2000yqk.googlegroups.com> <4e543134$0$305$14726298@news.sunsite.dk>

Show all headers | View raw


Arne Vajhøj wrote:
> Alex J wrote:
>> I'm curious whether it is possible to use JavacParser -
>> http://docjar.org/docs/api/com/sun/tools/javac/parser/JavacParser.html
>> - built-in to OpenJDK to parse standalone java files (though claimed
>> to be "internal use only API"). I googled but I've found no answers.
> 
> Java 1.6 and newer contains a supported callable Java compiler.
> 
> Use that.

+1.  

Java 5 and older are obsolete, so that settles that.
<http://en.wikipedia.org/wiki/Java_version_history#J2SE_5.0_.28September_30.2C_2004.29> 

> If you only want to syntax check you will need to discard the
> generated byte code in case of success, but that is easy.
> 
> The API is a bit complex many would say over engineered, but
> it works fine.

It pays to know the API.
<http://download.oracle.com/javase/6/docs/api/javax/tools/package-frame.html>

-- 
Lew

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Using sun javac to parse java source Alex J <vstrength@gmail.com> - 2011-08-23 13:24 -0700
  Re: Using sun javac to parse java source Arne Vajhøj <arne@vajhoej.dk> - 2011-08-23 19:00 -0400
    Re: Using sun javac to parse java source Lew <lewbloch@gmail.com> - 2011-08-23 17:25 -0700
      Re: Using sun javac to parse java source Arne Vajhøj <arne@vajhoej.dk> - 2011-08-23 21:52 -0400
        Re: Using sun javac to parse java source Lew <lewbloch@gmail.com> - 2011-08-23 20:20 -0700
          Re: Using sun javac to parse java source Arne Vajhøj <arne@vajhoej.dk> - 2011-08-24 19:22 -0400
            Re: Using sun javac to parse java source Lew <lewbloch@gmail.com> - 2011-08-24 21:05 -0700
    Re: Using sun javac to parse java source Sebastian <sebastian@undisclosed.invalid> - 2011-08-24 10:51 +0200
      Re: Using sun javac to parse java source Arne Vajhøj <arne@vajhoej.dk> - 2011-08-24 19:19 -0400

csiph-web