Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

juniffiro/java-defineClass

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

1 Commit

Repository files navigation

Java defineClass utility

defineClass() is a protected method of the ClassLoader class that allows you to convert a byte array into an instance of the class 'Class'.

I added the ability to use this method in any ClassLoader and extended its functionality.

How to use

/*
 * Example of creating a new instance
 * of a compiled Test.class
 * with defineClass()
 */
try {
 Class<?> testClass = Define.defineClass(
 getClass().getClassLoader(),
 Paths.get("./classes/Test.class"));
 testClass.newInstance();
} catch (Exception e) {
 throw new RuntimeException(e);
}

Open source

The project is an open source project distributed under the Apache License 2.0

Getting started

  1. Download the latest build from releases
  2. Read the FAQ and examples
  3. Enjoy!

Status

The project is in beta. Use at your own risk.

AltStyle によって変換されたページ (->オリジナル) /