Compile java files programmatically

R

Roedy Green

As you can see by following the link that you posted, I am the spec lead for
jsr199. I am also the lead engineer for javac at Sun. It is because jsr199
will not be included in 1.5 that we're documenting these methods for JDK 1.5,
thereby committing to their continued existence for a long time.

What problems do you have to solve in that?

1. providing for fishing source from files on disk or from files
generated in ram,

2. dealing with a mixture of encodings.

3. conditional compilation -- exactly when can you avoid
recompilation?

4. where to put the class files.

5. changing class files that are already running.
 
N

Neal Gafter

Roedy said:
What problems do you have to solve in that?

1. providing for fishing source from files on disk or from files
generated in ram,

2. dealing with a mixture of encodings.

3. conditional compilation -- exactly when can you avoid
recompilation?

4. where to put the class files.

5. changing class files that are already running.

The com.sun.tools.javac API provides no more than you can do using the
command-line interface. Its only advantage is that it runs in the same Java VM
that invokes it.

Issues (1), (2), and (4) will be addressed by jsr199's use of an abstract
filesystem API that you can use to specify source, class, and distination paths.

For issue (3) I suggest you see
<http://www.experimentalstuff.com/Technologies/JavaMake/>. Doing the dependence
analysis "properly" requires that it all be done before compilation begins,
which is part of the reason javac doesn't do this now.

Issue (5) is a VM issue, not a compilation issue, though I know there are a few
things happening in this area.

One thing you didn't mention is the ability to compile against the currently
loaded classes, rather than going to the disk for the class files. I'm working
on that too. That should speed up JSPs considerably.
 
B

bigbinc

Neal Gafter said:
As you can see by following the link that you posted, I am the spec lead for
jsr199. I am also the lead engineer for javac at Sun. It is because jsr199
will not be included in 1.5 that we're documenting these methods for JDK 1.5,
thereby committing to their continued existence for a long time.

Also join #java on irc.freenode.net, you too Roedy Green.
 
S

Scott Ellsworth

Berlin Brown said:
Keep up, they have been talking about it on slashdot for weeks now.

Gotta admit - I routinely discount anonymous cowards on most fora, thus
this "fiasco" is no more than any other momentary flurry.

As far as using slashdot to keep up, I prefer primary sources.
Aggregators like slashdot can be kinda fun, but not all that important
over the long haul.

Scott
 
B

Bryce

Berlin Brown wrote:


Thanks for the link! Actually, I DO keep up, and posted about how my
submission to their tightly-controlled forum was quashed after just
a few days. My concerns seem to be echoed by others, another fact I
noted.
Doesn't "Professional Open Source" sound a bit odd? I'm hardly
averse to people earning a decent living from their efforts, BTW.
I just don't like the idea of individuals or organizations purporting
their products to be "free" when they're not.

How is JBoss not "free"?
 

akg

Joined
Apr 18, 2012
Messages
1
Reaction score
0
How to compile java file programmatically

Hi can some one please send me((e-mail address removed)) code to compile a java file programmaticially and report any compilation error.

I have tried javaruntime and was able to compile java file but was not able to capture compilation erro.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top