GithubHelp home page GithubHelp logo

jscc's Introduction

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

jscc's People

Contributors

verhas avatar

Stargazers

agung susanto avatar

Watchers

agung susanto avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.