Thread: Command line HD mode & Java 11 reflection fix

Page 1 of 2 12 LastLast
Results 1 to 10 of 16
  1. #1 Command line HD mode & Java 11 reflection fix 
    Renown Programmer
    Greg's Avatar
    Join Date
    Jun 2010
    Posts
    1,124
    Thanks given
    227
    Thanks received
    756
    Rep Power
    1529
    From what I've seen high revision clients commonly throw a reflection error trying to load the .dll files when launching from cmd or IDE; causing the client to run in safe-mode and disable Open GL & DirectX. With Java 11 it throws this error

    Code:
    WARNING: An illegal reflective access operation has occurred
    WARNING: Illegal reflective access by Animable_Sub1_Sub1 (file:/C:/Users/Greg/IdeaProjects/rs-client/out/production/classes/) to method java.lang.Runtime.load0(java.lang.Class,java.lang.String)
    WARNING: Please consider reporting this to the maintainers of Animable_Sub1_Sub1
    WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
    WARNING: All illegal access operations will be denied in a future release
    To fix, find this code:

    Code:
    Class<?> var_class_31_ = Class.forName("java.lang.Runtime");
    				Class<?> var_class_32_ = Class.forName("java.lang.reflect.AccessibleObject");
    				Method method = var_class_32_.getDeclaredMethod("setAccessible", Boolean.TYPE);
    				Method method_33_ = var_class_31_.getDeclaredMethod("load0", Class.forName("java.lang.Class"), Class.forName("java.lang.String"));
    				method.invoke(method_33_, Boolean.TRUE);
    				method_33_.invoke(Runtime.getRuntime(), var_class, file.getPath());
    				method.invoke(method_33_, Boolean.FALSE);
    and replace with:

    Code:
                    System.load(file.getPath());
    Then below it, replace the
    NoSuchMethodException
    with:
    UnsatisfiedLinkError
    Reply With Quote  
     


  2. #2  
    Client Guru
    iGarrett's Avatar
    Join Date
    Dec 2013
    Posts
    441
    Thanks given
    117
    Thanks received
    95
    Rep Power
    66
    Nice one.

    I remember this started happening with JDK 9 was annoying as fuck.
    Quote Originally Posted by i am here View Post
    I have never messed with Eclipse. Is it a whole new revision or type of code?
    Quote Originally Posted by bibl View Post
    hahaha, good one m9. "deob" is short for "deobfuscated" which is not the same as decompiled.
    Reply With Quote  
     

  3. Thankful user:


  4. #3  
    ✥Gallifrey✥

    Castiel's Avatar
    Join Date
    Apr 2013
    Posts
    1,602
    Thanks given
    498
    Thanks received
    236
    Rep Power
    391
    Ddose this work for 718 then
    [Only registered and activated users can see links. ]
    Reply With Quote  
     

  5. #4  
    Renown Programmer
    Greg's Avatar
    Join Date
    Jun 2010
    Posts
    1,124
    Thanks given
    227
    Thanks received
    756
    Rep Power
    1529
    Quote Originally Posted by Killer Frost View Post
    Ddose this work for 718 then
    Yep, code will have different names, just search one of the strings and you'll find it
    Reply With Quote  
     

  6. #5  
    Registered Member
    Join Date
    Dec 2016
    Posts
    122
    Thanks given
    14
    Thanks received
    30
    Rep Power
    61
    For the people here that use a Poanizer-X based client

    I found it in Animable_Sub1_Sub1.java (method830 around line 320)
    Reply With Quote  
     

  7. #6  
    Registered Member
    Join Date
    Nov 2008
    Posts
    76
    Thanks given
    4
    Thanks received
    0
    Rep Power
    7
    For some reason I'm getting a white screen when replacing it with this. The reflection error also happens to me on Java 8.

    Edit: Figured out the issue, there was a duplicate System.load below, but still launching in safe mode.
    Reply With Quote  
     

  8. #7  




    Scu11's Avatar
    Join Date
    Aug 2007
    Age
    26
    Posts
    16,203
    Thanks given
    7,183
    Thanks received
    12,164
    Rep Power
    5000
    Code:
    	@SuppressWarnings("unchecked")
    	public static boolean loadNativeLibrary(Class libraryClazz, String name) {
    		Class nativeClazz = (Class) nativeLibraries.get(name);
    		if (nativeClazz != null) {
    			if (nativeClazz.getClassLoader() != libraryClazz.getClassLoader()) {
    				return false;
    			}
    			return true;
    		}
    
    		File file = null;
    		if (file == null) {
    			file = (File) loadedLibraries.get(name);
    		}
    
    		if (file != null) {
    			try {
    				file = new File(file.getCanonicalPath());
    				Method load0 = Runtime.class.getDeclaredMethod("load0", Class.class, String.class);
    				load0.setAccessible(true);
    				load0.invoke(Runtime.getRuntime(), libraryClazz, file.getPath());
    				load0.setAccessible(false);
    				nativeLibraries.put(name, libraryClazz);
    				return true;
    			} catch (NoSuchMethodException nosuchmethodexception) {
    				System.load(file.getPath());
    				nativeLibraries.put(name, Class304.class);
    				return true;
    			} catch (Throwable throwable) {
    				/* empty */
    			}
    		}
    
    		return false;
    	}
    This is the entire function refactored (before being patched).

    [Only registered and activated users can see links. ]



    Reply With Quote  
     

  9. Thankful user:


  10. #8  
    Banned

    Join Date
    Jun 2010
    Age
    23
    Posts
    4,728
    Thanks given
    1,646
    Thanks received
    1,522
    Rep Power
    0
    Bump for this because I forgot about this top goat code.
    Reply With Quote  
     

  11. #9  
    Registered Member

    Join Date
    Dec 2009
    Posts
    736
    Thanks given
    307
    Thanks received
    386
    Rep Power
    740
    Don't you need to run with Java 6 anyways in order to get OpenGL and DirectX working?
    link removed
    Reply With Quote  
     

  12. #10  
    number 1 sponsor

    Join Date
    Aug 2017
    Posts
    877
    Thanks given
    658
    Thanks received
    650
    Rep Power
    4691
    Quote Originally Posted by Displee View Post
    Don't you need to run with Java 6 anyways in order to get OpenGL and DirectX working?
    java 7 should work
    Reply With Quote  
     

  13. Thankful user:


Page 1 of 2 12 LastLast

Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. [source]Scripting language using Java's reflection
    By wizzyt21 in forum Application Development
    Replies: 9
    Last Post: 04-04-2010, 02:22 PM
  2. batch command line problem.
    By digistr in forum Software
    Replies: 0
    Last Post: 03-19-2010, 05:33 PM
  3. Replies: 4
    Last Post: 10-21-2009, 10:20 PM
  4. Using command-line parameters
    By Ikram in forum Application Development
    Replies: 4
    Last Post: 08-12-2009, 03:59 PM
  5. Command Maker purely written in java (beta)
    By quest rs in forum Tools
    Replies: 7
    Last Post: 03-02-2008, 01:39 PM
Tags for this Thread

View Tag Cloud

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •