jscc

Sonatype helps open source projects to set up Maven repositories on https://oss.sonatype.org/

License

License

GroupId

GroupId

com.javax0
ArtifactId

ArtifactId

jscc
Last Version

Last Version

1.0.1
Release Date

Release Date

Type

Type

jar
Description

Description

jscc
Sonatype helps open source projects to set up Maven repositories on https://oss.sonatype.org/
Project URL

Project URL

http://maven.apache.org
Source Code Management

Source Code Management

https://github.com/verhas/jscc

Download jscc

How to add to project

<!-- https://jarcasting.com/artifacts/com.javax0/jscc/ -->
<dependency>
    <groupId>com.javax0</groupId>
    <artifactId>jscc</artifactId>
    <version>1.0.1</version>
</dependency>
// https://jarcasting.com/artifacts/com.javax0/jscc/
implementation 'com.javax0:jscc:1.0.1'
// https://jarcasting.com/artifacts/com.javax0/jscc/
implementation ("com.javax0:jscc:1.0.1")
'com.javax0:jscc:jar:1.0.1'
<dependency org="com.javax0" name="jscc" rev="1.0.1">
  <artifact name="jscc" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.javax0', module='jscc', version='1.0.1')
)
libraryDependencies += "com.javax0" % "jscc" % "1.0.1"
[com.javax0/jscc "1.0.1"]

Dependencies

compile (1)

Group / Artifact Type Version
org.slf4j : slf4j-api jar 1.7.5

test (2)

Group / Artifact Type Version
ch.qos.logback : logback-classic jar 1.0.13
junit : junit jar 4.11

Project Modules

There are no modules declared in this project.

jscc

A very simple Java source compiler code based on the javac provided by the JDK. The API built into the Java runtime is complex because it is designed to handle several input (Java source code) and output (generated byte code) reading and writing possibilities. This needs the implementation of complex classes that provide the source code and can store the generated byte code.

To ease the burden this library implements these classes along with a class loader to handle the simple case when you want to compile Java source available during run-time in String objects and you want to load the compiled classes instead generating .class files.

The library also implements a facade to provide a simple API.

Usage

import com.javax0.jscc.Compiler;

...

// create a new compiler
Compiler compiler = new Compiler();
// compile and load the class providing source code and
// fully qualified class name
Class<?> newClass = compiler.compile(sourceCode, className);

Using the class you can use the standard JDK way to get a new instance of the class calling

// get a new instance
Object object = newClass.newInstance();

For more information read the JavaDoc documentation of the project. This may be needed in case you want to handle source code that contains error, or you want to compile a class that needs special class loader.

This project was developed primarily to support the djcproxy library.

Maven Dependency

		<dependency>
			<groupId>com.javax0</groupId>
			<artifactId>jscc</artifactId>
			<version>1.0.1</version>
		</dependency>

Releases

  • 1.0.1 Handles source code that generate more than one class. For example classes that contain nested or inner classes, anonymous classes. Previous release did not handle the case and is not able to load the auxiliary classes.
  • 1.0.0 Initial release

Versions

Version
1.0.1
1.0.0