Giter Site home page Giter Site logo

chenghanpeng / jdk12 Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 3.0 130.96 MB

jdk12

License: GNU General Public License v2.0

Makefile 0.02% Shell 0.24% JavaScript 1.07% M4 0.10% sed 0.01% Roff 0.16% HTML 0.37% CSS 0.01% Python 0.06% Java 78.06% C++ 13.62% XSLT 0.22% Perl 0.01% C 5.63% Assembly 0.03% DTrace 0.01% GDB 0.01% Objective-C 0.39% Batchfile 0.01% Red 0.01%

jdk12's People

Contributors

chenghanpeng avatar

Stargazers

 avatar

jdk12's Issues

Unable to Load jar file during plugin startup using JDK 12

I am trying to load a jar file during plugin startup. But unable to load it with JDK 12 or later version.
below is the code snippet :
-------------------------------------CODE---------------------------------------------------
URLClassLoader urlSysLoader = new URLClassLoader(new URL[] {url}, sysLoader);
Method method = sysClass.getDeclaredMethod("addURL", parameters);
/**

The addURL() appends the specified URL to the list of URLs to search for
classes and resources. and since this Method is Protected and we are not inheriting
i'm forced to make it visible.
*/
method.setAccessible(true);
// Invoke addURL method with jar URL to add the classes to URL ClassLoader
method.invoke(urlSysLoader, new Object[] { url });
Field scl = ClassLoader.class.getDeclaredField("scl");
scl.setAccessible(true);
// Replace the static scl (System Class Loader for running instance) with
// newly created URL ClassLoader (system class loader + jar files loaded)
scl.set(null, urlSysLoader);
-----------------------------------------CODE----------------------------------------------
Getting below error :
----------------------------------------ERROR---------------------------------------------------------------------------------
java.lang.NoSuchFieldException: scl
at java.base/java.lang.Class.getDeclaredField(Class.java:2569)
at com.unisys.tde.core.characterset.OS2200CharSetPlugin.loadCharSetLib(OS2200CharSetPlugin.java:160)
at com.unisys.tde.core.characterset.OS2200CharSetPlugin$1.run(OS2200CharSetPlugin.java:66)
----------------------------------------ERROR---------------------------------------------------------------------------------

The above code was working till JDK 11 version.

Please let me know any suggestion or any other alternative approach to achieve the same.

Thanks and Regards,
Raghu

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.