Giter Site home page Giter Site logo

urlclassloader-util's Introduction

URLClassLoader util

Utilities for manipulating sun.misc.URLClassLoaders

Status

Stable branch

Build Status

Development branch

Build Status

Usage

You can add and remove entries for the classloader of your preference. Entries must be java.net.URLs (or java.net.URIs, or java.io.Files, or java.lang.Strings that can be transformed to URLs). The ClassLoader must have a field of type URLClassPath, that is what this library actually manipulates.

Please be wary that, despite being designed with some degree of reliability in mind, this library accesses non-public APIs, and as such may work only on a subset of Java Runtime Environments, and newer versions of working JREs may break it. The library is tested against multiple JREs, please refer to the Travis CI build to verify that the JRE you are interested in is currently supported.

Example with system ClassLoader

// Also URL, URI, or File are ok
final String myDir = ...;
URLClassLoaderUtil.addFirst(myDir);
URLClassLoaderUtil.remove(myDir);
URLClassLoaderUtil.addLast(myDir);

Example with the current class ClassLoader

final ClassLoader cl = MyClass.class.getClassLoader();
// Also URL, URI, or File are ok
final String myDir = ...;
URLClassLoaderUtil.addFirst(myDir, cl);
URLClassLoaderUtil.remove(myDir, cl);
URLClassLoaderUtil.addLast(myDir, cl);

Import URLClassLoader util in your project

I warmly suggest to use Gradle, Maven or a similar system to deal with dependencies within your project. In this case, you can use this product by importing the following Maven dependency:

<dependency>
    <groupId>org.danilopianini</groupId>
    <artifactId>urlclassloader-util</artifactId>
    <version>VERSION_YOU_WANT_TO_USE</version>
</dependency>

or the following Gradle dependency:

compile 'org.danilopianini:urlclassloader-util:VERSION_YOU_WANT_TO_USE'

Alternatively, you can grab the latest jar and throw it in your classpath. In this case, be sure to include the dependencies of this project in your classpath as well.

urlclassloader-util's People

Contributors

danysk avatar

Stargazers

 avatar

Watchers

 avatar  avatar  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.