Hello!
I’m using ProGuard to shrink my exported game’s jar from a 1.14 MiB to 193 KiB.
However when I run the shrunk jar file I get the following exception:
C:\Users\Me\Desktop>"C:\Program Files (x86)\Java\jre6\bin\java.exe" -jar test-
fix.jar localhost
Exception in thread "AWT-EventQueue-0" java.lang.RuntimeException: java.lang.NoS
uchMethodException: com.sun.opengl.impl.windows.k.create(java.nio.ByteBuffer)
at com.sun.opengl.impl.JAWT_DrawingSurfaceInfo.a(Unknown Source)
at com.sun.opengl.impl.JAWT_DrawingSurfaceInfo.a(Unknown Source)
at com.sun.opengl.impl.windows.i.d(Unknown Source)
at com.sun.opengl.impl.windows.b.b(Unknown Source)
at com.sun.opengl.impl.f.a(Unknown Source)
at com.sun.opengl.impl.g.a(Unknown Source)
at javax.media.opengl.q.a(Unknown Source)
at javax.media.opengl.q.d(Unknown Source)
at javax.media.opengl.q.paint(Unknown Source)
at sun.awt.RepaintArea.paintComponent(Unknown Source)
at sun.awt.RepaintArea.paint(Unknown Source)
at sun.awt.windows.WComponentPeer.handleEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: java.lang.NoSuchMethodException: com.sun.opengl.impl.windows.k.create
(java.nio.ByteBuffer)
at java.lang.Class.getMethod(Unknown Source)
... 21 more
I can run the jar fine when it is not passed through ProGuard. As you see I’m using Jogl.
ProGuard is warning me about some stuff when I made “test-fix.jar”, but I don’t know what it means:
ProGuard, version 4.3
Reading program jar [C:\Users\Me\Desktop\test.jar]
Reading library jar [C:\Program Files (x86)\Java\jre6\lib\rt.jar]
Note: com.sun.opengl.util.JOGLAppletLauncher$6: can't find dynamically referenced class net.java.games.joal.impl.NativeLibLoader
Note: com.sun.opengl.impl.x11.X11SunJDKReflection$1: can't find dynamically referenced class sun.awt.X11GraphicsDevice
Note: com.sun.opengl.impl.x11.X11SunJDKReflection$1: can't find dynamically referenced class sun.awt.X11GraphicsConfig
Note: com.sun.gluegen.runtime.NativeLibLoader: can't find dynamically referenced class org.jdesktop.applet.util.JNLPAppletLauncher
Note: com.sun.opengl.util.JOGLAppletLauncher calls '(java.applet.Applet)Class.forName(variable).newInstance()'
Note: com.sun.opengl.impl.Java2D$2: can't find dynamically referenced class sun.java2d.opengl.OGLUtilities
Note: com.sun.opengl.impl.Java2D$1: can't find dynamically referenced class sun.java2d.opengl.OGLUtilities
Note: com.sun.opengl.impl.Java2D$1: can't find dynamically referenced class sun.java2d.opengl.CGLSurfaceData
Note: com.sun.opengl.impl.NativeLibLoader: can't find dynamically referenced class org.jdesktop.applet.util.JNLPAppletLauncher
Note: com.sun.opengl.util.JOGLAppletLauncher$6 accesses a method 'begin()' dynamically
Maybe this is program method 'com.sun.opengl.impl.x11.DRIHack { void begin(); }'
Maybe this is library method 'java.nio.channels.spi.AbstractInterruptibleChannel { void begin(); }'
Maybe this is library method 'java.nio.channels.spi.AbstractSelector { void begin(); }'
Note: com.sun.opengl.util.JOGLAppletLauncher$6 accesses a method 'end()' dynamically
Maybe this is program method 'com.sun.opengl.impl.x11.DRIHack { void end(); }'
Maybe this is program method 'javax.media.opengl.glu.GLUtessellatorCallback { void end(); }'
Maybe this is program method 'javax.media.opengl.glu.GLUtessellatorCallbackAdapter { void end(); }'
Maybe this is library method 'java.awt.PrintJob { void end(); }'
Maybe this is library method 'java.nio.channels.spi.AbstractSelector { void end(); }'
Maybe this is library method 'java.util.regex.MatchResult { int end(); }'
Maybe this is library method 'java.util.regex.Matcher { int end(); }'
Maybe this is library method 'java.util.zip.Deflater { void end(); }'
Maybe this is library method 'java.util.zip.Inflater { void end(); }'
Maybe this is library method 'javax.swing.undo.CompoundEdit { void end(); }'
Maybe this is library method 'javax.swing.undo.StateEdit { void end(); }'
Maybe this is library method 'javax.swing.undo.UndoManager { void end(); }'
Maybe this is library method 'sun.font.LayoutPathImpl { double end(); }'
Maybe this is library method 'sun.font.LayoutPathImpl$EmptyPath { double end(); }'
Maybe this is library method 'sun.font.LayoutPathImpl$SegmentPath { double end(); }'
Maybe this is library method 'sun.print.PrintJob2D { void end(); }'
Note: com.sun.opengl.util.JOGLAppletLauncher$6 accesses a method 'disableLoading()' dynamically
Maybe this is program method 'com.sun.gluegen.runtime.NativeLibLoader { void disableLoading(); }'
Maybe this is program method 'com.sun.opengl.impl.NativeLibLoader { void disableLoading(); }'
Note: com.sun.opengl.impl.x11.X11SunJDKReflection$1 accesses a declared method 'getScreen()' dynamically
Maybe this is library method 'sun.awt.Win32GraphicsDevice { int getScreen(); }'
Note: com.sun.opengl.impl.x11.X11SunJDKReflection$1 accesses a declared method 'getVisual()' dynamically
Maybe this is library method 'sun.awt.Win32GraphicsConfig { int getVisual(); }'
Note: com.sun.opengl.impl.Java2D$1 accesses a declared method 'isQueueFlusherThread()' dynamically
Maybe this is program method 'com.sun.opengl.impl.Java2D { boolean isQueueFlusherThread(); }'
Maybe this is library method 'sun.java2d.opengl.OGLRenderQueue { boolean isQueueFlusherThread(); }'
Note: there were 8 unresolved dynamic references to classes or interfaces.
You should check if you need to specify additional program jars.
Note: there were 1 class casts of dynamically created class instances.
You might consider explicitly keeping the mentioned classes and/or
their implementations (using '-keep').
Note: there were 6 accesses to class members by means of introspection.
You should consider explicitly keeping the mentioned class members
(using '-keep' or '-keepclassmembers').
Preparing output jar [C:\Users\Me\Desktop\test-fix.jar]
Copying resources from program jar [C:\Users\Me\Desktop\test.jar]
Processing completed successfully
In the end it completes successfully. It suggests that I should consider using “-keep” or “-keepclassmembers” but I don’t know where I should write that, or what exactly what I should write.
I’m using ProGuard 4.3 GUI-version.
Anybody can solve this mystery?