Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #7338
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!.POSTED!not-for-mail |
|---|---|
| From | Sebastian <sebastian@undisclosed.invalid> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Using sun javac to parse java source |
| Date | Wed, 24 Aug 2011 10:51:24 +0200 |
| Organization | albasani.net |
| Lines | 30 |
| Message-ID | <j32e2d$jgg$1@news.albasani.net> (permalink) |
| References | <66227810-c927-4197-a138-f25b54f26f7f@k8g2000yqk.googlegroups.com> <4e543134$0$305$14726298@news.sunsite.dk> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 8bit |
| X-Trace | news.albasani.net rEExRLNDE1t9uNhJLew0phbI3hu082zR6AmNFz/VUknLfI6r3cMko92RsUGO7ms4rEB95PXIXN9OAr3knMz60FUwXEcQGWcZZ1jYAvl0IT1Pz2LQyx7aFFv2t2mjIYdI |
| NNTP-Posting-Date | Wed, 24 Aug 2011 08:51:25 +0000 (UTC) |
| Injection-Info | news.albasani.net; logging-data="K3ce6O1AbFgey6YUtGis7m/vrWXXwYyENGGEbJ5fijbYFFrFflP6zA9m1OP8Pb2SZxd8vshEPKBj0sPOMmh1250qVZ4wLSoJfR/z5o9F4K37HJswnUQNP6onD9/MGl1l"; mail-complaints-to="abuse@albasani.net" |
| User-Agent | Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9 |
| In-Reply-To | <4e543134$0$305$14726298@news.sunsite.dk> |
| Cancel-Lock | sha1:zpxKeW15PzJh7b0H7iHc9MA2vfY= |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:7338 |
Show key headers only | View raw
Am 24.08.2011 01:00, schrieb Arne Vajhøj: > On 8/23/2011 4:24 PM, 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. > > 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. > > Arne > > You might find a detailed example useful. There is an article about "Dynamic Code Generation with Java Compiler API in Java 6" by Swaminathan Bhaskar at http://www.scribd.com/doc/56642760/Java-Compiler The article shows how to compile source from strings to byte arrays. -- Sebastian
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar
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