STBC
STBC,
the
SSCCE
Text Based Compiler,
is a
simple tool for checking that Java code written in the form of an
SSCCE is actually compilable!
STBC will run on any computer with a version 1.6+ Java
Plug-In*
JDK
(AKA
SDK).
* The
API that
STBC uses is merely a public interface to the compiler in
the tools.jar that is distributed only with
JDKs (though the 'public
JRE'
of the JDK also seems to acquire a tools.jar). This leads to
some unusual requirements in running either the native jar, or the web start app.
See help & configuration for more details.
To download (or run) STBC, click the Download STBC button.
Run the Jar using the JRE of a JDK.
Many development environments will already
be correctly set-up to run STBC by 'double clicking' the jar.
If not, it can be configured externally or
at runtime.
To launch STBC using webstart, click the
Launch STBC button.
To work under webstart, STBC requires the JRE of an JDK.
The path can be configured externally or
at runtime.
Download the source and build files by clicking Download Source.
- The thread
Example code for java compiler with a simple GUI
at the Sun forums, for the basic source code (of this relatively simple tool).
Feel free to report bugs or make suggestions on that thread.
- As usual, the Mindprod site has a good overview of
on the fly
compilation, with some examples and many valuable links. This
page is especially worthy of mention since on-the-fly compilation
has been available for a long while, whereas the JavaCompiler
interface was only introduced into the J2SE in Java 6.
- JavaDocs of the
javax.tools package and the classes used in this app.
javax.tools.ToolProvider.
The docs for
getSystemJavaCompiler() mention that it returns
"the compiler provided with this platform or null if no compiler is provided",
but do not make clear why it might be null,
nor the fact that the compiler will not be available to applets or webstart apps.
javax.tools.JavaCompiler.
The public interface to the Java compiler.
javax.tools.SimpleJavaFileObject.
A subclass of this allows us to compile source code contained in a String.
The code of the JavaSourceFromString is from the JavaDocs for the
JavaCompiler.
SoftPedia Certified
Softpedia guarantees that STBC 1.0 is 100% CLEAN, which means it does not contain any form of malware,
including spyware, viruses, trojans and backdoors.
|