Convenience tools for the JDK

S

Stefan Ram

Why does Sun not include a program »jrun« in the JDK that
takes a Java source file path as its argument, then compiles
this in-memory and starts the result (assuming there were no
compile-errors and the source has a static main method)?

This will come in handy for programmers sometimes and will
make starting a first »hello, world!« application easier for
beginners.

Why do they not associate such a program with .java-Files?
Then, you could simply »run« java source files like batch files.

(Yes, I know how to implement this myself. But the idea seems
so natural that I wonder why it not already has been done by
Sun long ago.)
 
J

Jan Thomä

Why does Sun not include a program »jrun« in the JDK that
takes a Java source file path as its argument, then compiles
this in-memory and starts the result (assuming there were no
compile-errors and the source has a static main method)?

I never missed such a tool in fact, and while i only can speculate
about why Sun would or would not do something, I suppose there is
simply no demand for it. It would be limited to very few cases as any
bigger java application has more than just a single file. So i think
it's just not worth creating a program that does

javac Hello.java
java Hello

and after the release collecting a lot of trouble tickets about people
complaining that this doesn't work for two or more files. If you
really need such a thing, i think a shell script does this trick nicely.

Best regards,
Jan
 
A

Arne Vajhøj

Stefan said:
Why does Sun not include a program »jrun« in the JDK that
takes a Java source file path as its argument, then compiles
this in-memory and starts the result (assuming there were no
compile-errors and the source has a static main method)?

This will come in handy for programmers sometimes and will
make starting a first »hello, world!« application easier for
beginners.

Why do they not associate such a program with .java-Files?
Then, you could simply »run« java source files like batch files.

Existing java tools and AFAIK tools for all other compiled languages
try to open an IDE or editor when double clicking on a source
code file.

Running a .java file would by highly unexpected.

And considering that Java is intended as a language for
programmers, then I can not see any need for SUN delivering
jrun (your command - not the app server).

Arne
 

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,780
Messages
2,569,608
Members
45,250
Latest member
Charlesreero

Latest Threads

Top