• 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 ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Javac api

 
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
Can some one explain how to use the com.sun.tools.javac api with some examples.. I did bit of google but could not get much resources out of it. the api is of jdk1.5 not 1.6..

Regards
 
Bartender
Posts: 1638
IntelliJ IDE MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Follow this link:
http://www.javaworld.com/javatips/jw-javatip131.html

However, i would like to know as to why you need this class but for some jazz to show off
 
Ranganath Junpal
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
sorry its not for show off.. i am building an tool for which this api is very much needed.. anyways thanks for the url.
 
Nitesh Kant
Bartender
Posts: 1638
IntelliJ IDE MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey, sorry for the last comment. That was not meant to hurt.
But it sounds interesting to me, so it will be great if you can tell me the scenario.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Using javac programmatically can come in handy for various purposes. I'm using it in a piece of code where a user can enter mathematical formulas. Instead of trying to interpret those, I'm wrapping them inside a Java class, and load the class dynamically. That eventually produces native code, and is much faster than anything I could code up to interpret those formulas.
 
Ranganath Junpal
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Basically we are using it for an online labs(virtual labs).. like we are building a website where in people can learn about the language like java, jython online and experiment there programs in these virtual labs N forums. Its basically for people whos is enthusiastic about the technology but not able to afford to have a pc and other resources to learn. This website is reachable to them at the cost of just 10-15 bucks per hour (in India) to browse through and learn these technologies..
So i wanted to get familiar with this api before i go ahead with the design and understand the api..

Regards
 
Nitesh Kant
Bartender
Posts: 1638
IntelliJ IDE MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey thanks Ulf & Ranganath, i never knew that people used this class. Thanks for the enlightment
 
Ranganath Junpal
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi all,

Actually the url did help to get some idea bout the javac api. now i used this Main class of javac and used Main.compile(args) method. now i need to redirect the output to text area. please let me know how to go about this in javac api..

Thank you
 
Ranganath Junpal
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi all,

Actually the url did help to get some idea bout the javac api. now i used this Main class of javac and used Main.compile(args) method. now i need to redirect the output to text area. please let me know how to go about this in javac api..

Thank you
 
Nitesh Kant
Bartender
Posts: 1638
IntelliJ IDE MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can use the overloaded form of compile method that takes a PrintWriter.
This writer points to the stream where the output is to be printed.
 
Ranganath Junpal
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
cool, i was trying it.. thanks a lot.. good to know i am on a right track..
 
reply
    Bookmark Topic Watch Topic
  • New Topic