Thread: [jnc-users] Null PointerException at java.net.URLClassLoader.getPermissions
Status: Beta
Brought to you by:
soapy
From: Keith B. <kei...@fl...> - 2009-11-22 15:36:11
|
Hi, I made some good progress compiling an app I've written, I came across a few errors during the first few iterations of compilation. I've been able to resolve most problems I came across by adding missing dependencies (jar files) for various packages I'm using. However I've come to a particular problem that I'm really stumped with and would appreciate any help anyone could offer. I've compiled my app using normal methods through the UI and compilation and packing seems successful. However when I run the app (windows or linux, both behave the same and return the same errors) I was initially getting this error: [root@tserver tmp]# ./linux Exception in thread "main" java.lang.NoClassDefFoundError: org.apache.log4j.xml.DOMConfigurator at java.lang.Class.initializeClass(linux) at java.lang.Class.newInstance(linux) at org.apache.log4j.helpers.OptionConverter.instantiateByClassName(linux) at org.apache.log4j.helpers.OptionConverter.selectAndConfigure(linux) at org.apache.log4j.LogManager.<clinit>(linux) at java.lang.Class.initializeClass(linux) at org.apache.log4j.LogManager.getLogger(linux) at org.apache.log4j.Logger.getLogger(linux) at com.flare.applications.FileSquirrel.App.main(linux) Caused by: java.lang.ClassNotFoundException: org.xml.sax.ErrorHandler not found in gnu.gcj.runtime.SystemClassLoader{urls=[], parent=gnu.gcj.runtime.ExtensionClassLoader{urls=[], parent=null}} at java.net.URLClassLoader.findClass(linux) at java.lang.ClassLoader.loadClass(linux) at java.lang.ClassLoader.loadClass(linux) at gnu.gcj.runtime.SystemClassLoader.findClass(linux) at java.lang.ClassLoader.loadClass(linux) at java.lang.ClassLoader.loadClass(linux) at java.lang.Class.initializeClass(linux) ...8 more I added the libgcj jar to the classpath: export CLASSPATH=/tmp/libgcj-4.3.0.jar And now I'm getting this error: [root@tserver tmp]# ./linux Exception in thread "main" java.lang.NoClassDefFoundError: org.apache.log4j.xml.DOMConfigurator at java.lang.Class.initializeClass(linux) at java.lang.Class.newInstance(linux) at org.apache.log4j.helpers.OptionConverter.instantiateByClassName(linux) at org.apache.log4j.helpers.OptionConverter.selectAndConfigure(linux) at org.apache.log4j.LogManager.<clinit>(linux) at java.lang.Class.initializeClass(linux) at org.apache.log4j.LogManager.getLogger(linux) at org.apache.log4j.Logger.getLogger(linux) at com.flare.applications.FileSquirrel.App.main(linux) Caused by: java.lang.NullPointerException at java.net.URLClassLoader.getPermissions(linux) at java.security.SecureClassLoader.getProtectionDomain(linux) at java.security.SecureClassLoader.defineClass(linux) at java.net.URLClassLoader.findClass(linux) at java.lang.ClassLoader.loadClass(linux) at java.lang.ClassLoader.loadClass(linux) at gnu.gcj.runtime.SystemClassLoader.findClass(linux) at java.lang.ClassLoader.loadClass(linux) at java.lang.ClassLoader.loadClass(linux) at java.lang.Class.initializeClass(linux) ...8 more This has me really stumped and any help would be greatly appreciated. Keith |
From: Marco T. <ma...@mt...> - 2009-11-22 20:10:17
|
Dear Keith Keith Boynton wrote: > Hi, > > I made some good progress compiling an app I've written, I came across a > few errors during the first few iterations of compilation. I've been > able to resolve most problems I came across by adding missing > dependencies (jar files) for various packages I'm using. > > However I've come to a particular problem that I'm really stumped with > and would appreciate any help anyone could offer. > > I've compiled my app using normal methods through the UI and compilation > and packing seems successful. However when I run the app (windows or > linux, both behave the same and return the same errors) I was initially > getting this error: > > [root@tserver tmp]# ./linux > Exception in thread "main" java.lang.NoClassDefFoundError: > org.apache.log4j.xml.DOMConfigurator > at java.lang.Class.initializeClass(linux) > at java.lang.Class.newInstance(linux) > at org.apache.log4j.helpers.OptionConverter.instantiateByClassName(linux) > at org.apache.log4j.helpers.OptionConverter.selectAndConfigure(linux) > at org.apache.log4j.LogManager.<clinit>(linux) > at java.lang.Class.initializeClass(linux) > at org.apache.log4j.LogManager.getLogger(linux) > at org.apache.log4j.Logger.getLogger(linux) > at com.flare.applications.FileSquirrel.App.main(linux) > Caused by: java.lang.ClassNotFoundException: org.xml.sax.ErrorHandler Please read the manual. Especially the last part of step 1. This might already do the job: static { org.xml.sax.ErrorHandler.class.getName(); } If not, please read through the mail archive. There were some discussions about parts of libgcj not getting into the binary and how to solve it (ar x libgcj and adding the objects to the compilation). > not found in gnu.gcj.runtime.SystemClassLoader{urls=[], > parent=gnu.gcj.runtime.ExtensionClassLoader{urls=[], parent=null}} > at java.net.URLClassLoader.findClass(linux) > at java.lang.ClassLoader.loadClass(linux) > at java.lang.ClassLoader.loadClass(linux) > at gnu.gcj.runtime.SystemClassLoader.findClass(linux) > at java.lang.ClassLoader.loadClass(linux) > at java.lang.ClassLoader.loadClass(linux) > at java.lang.Class.initializeClass(linux) > ...8 more > I added the libgcj jar to the classpath: > export CLASSPATH=/tmp/libgcj-4.3.0.jar You try to native compile something. So you want to get a binary from your application, not some links to a runtime lying somewhere... I wonder why people always try setting the classpath. This has nothing to do with native compilation... It's too bad GCJ also is a VM and this has an effect even if GCJ is used for native compilation. Hope this helps Marco > And now I'm getting this error: > > [root@tserver tmp]# ./linux > Exception in thread "main" java.lang.NoClassDefFoundError: > org.apache.log4j.xml.DOMConfigurator > at java.lang.Class.initializeClass(linux) > at java.lang.Class.newInstance(linux) > at org.apache.log4j.helpers.OptionConverter.instantiateByClassName(linux) > at org.apache.log4j.helpers.OptionConverter.selectAndConfigure(linux) > at org.apache.log4j.LogManager.<clinit>(linux) > at java.lang.Class.initializeClass(linux) > at org.apache.log4j.LogManager.getLogger(linux) > at org.apache.log4j.Logger.getLogger(linux) > at com.flare.applications.FileSquirrel.App.main(linux) > Caused by: java.lang.NullPointerException > at java.net.URLClassLoader.getPermissions(linux) > at java.security.SecureClassLoader.getProtectionDomain(linux) > at java.security.SecureClassLoader.defineClass(linux) > at java.net.URLClassLoader.findClass(linux) > at java.lang.ClassLoader.loadClass(linux) > at java.lang.ClassLoader.loadClass(linux) > at gnu.gcj.runtime.SystemClassLoader.findClass(linux) > at java.lang.ClassLoader.loadClass(linux) > at java.lang.ClassLoader.loadClass(linux) > at java.lang.Class.initializeClass(linux) > ...8 more > This has me really stumped and any help would be greatly appreciated. > > Keith > > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------------ > Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day > trial. Simplify your report design, integration and deployment - and focus on > what you do best, core application coding. Discover what's new with > Crystal Reports now. http://p.sf.net/sfu/bobj-july > > > ------------------------------------------------------------------------ > > _______________________________________________ > javaCompiler-users mailing list > jav...@li... > https://lists.sourceforge.net/lists/listinfo/javacompiler-users |
From: Keith B. <kei...@fl...> - 2009-11-23 09:02:11
|
Hi Marco, Thanks for your very speedy response. "Please read the manual. Especially the last part of step 1. This might already do the job" I do apologise, I should have specified in my original history that I have already tried the static {} references suggestion from the manual. Unfortunately that isn't making a difference. "If not, please read through the mail archive. There were some discussions about parts of libgcj not getting into the binary and how to solve it" I'll have a deeper search through the archives, great news that there is already a discussion about it. I didn't find it on my first attempts. "I wonder why people always try setting the classpath. This has nothing to do with native compilation" Is there not situations where this would be helpful (if indeed it does work)? I can think of an app I would like to develop but wouldn't get a license to distribute some of the jar dependencies and also wouldn't be allowed to compile them into my app. Thanks again Marco for your responses, hopefully I'll find what I need in the archives! Keith -------------------------------------------------- From: "Marco Trudel" <ma...@mt...> Sent: Sunday, November 22, 2009 7:43 PM To: "Keith Boynton" <kei...@fl...> Cc: <jav...@li...> Subject: Re: [jnc-users] Null PointerException atjava.net.URLClassLoader.getPermissions > Dear Keith > > Keith Boynton wrote: >> Hi, >> >> I made some good progress compiling an app I've written, I came across a >> few errors during the first few iterations of compilation. I've been >> able to resolve most problems I came across by adding missing >> dependencies (jar files) for various packages I'm using. >> >> However I've come to a particular problem that I'm really stumped with >> and would appreciate any help anyone could offer. >> >> I've compiled my app using normal methods through the UI and compilation >> and packing seems successful. However when I run the app (windows or >> linux, both behave the same and return the same errors) I was initially >> getting this error: >> >> [root@tserver tmp]# ./linux >> Exception in thread "main" java.lang.NoClassDefFoundError: >> org.apache.log4j.xml.DOMConfigurator >> at java.lang.Class.initializeClass(linux) >> at java.lang.Class.newInstance(linux) >> at >> org.apache.log4j.helpers.OptionConverter.instantiateByClassName(linux) >> at org.apache.log4j.helpers.OptionConverter.selectAndConfigure(linux) >> at org.apache.log4j.LogManager.<clinit>(linux) >> at java.lang.Class.initializeClass(linux) >> at org.apache.log4j.LogManager.getLogger(linux) >> at org.apache.log4j.Logger.getLogger(linux) >> at com.flare.applications.FileSquirrel.App.main(linux) >> Caused by: java.lang.ClassNotFoundException: org.xml.sax.ErrorHandler > > Please read the manual. Especially the last part of step 1. > This might already do the job: > static > { > org.xml.sax.ErrorHandler.class.getName(); > } I do apologise, I should have specified in my original history that I have already tried the static {} references suggestion from the manual. Unfortunately that isn't making a difference. > If not, please read through the mail archive. There were some > discussions about parts of libgcj not getting into the binary and how to > solve it (ar x libgcj and adding the objects to the compilation). > >> not found in gnu.gcj.runtime.SystemClassLoader{urls=[], >> parent=gnu.gcj.runtime.ExtensionClassLoader{urls=[], parent=null}} >> at java.net.URLClassLoader.findClass(linux) >> at java.lang.ClassLoader.loadClass(linux) >> at java.lang.ClassLoader.loadClass(linux) >> at gnu.gcj.runtime.SystemClassLoader.findClass(linux) >> at java.lang.ClassLoader.loadClass(linux) >> at java.lang.ClassLoader.loadClass(linux) >> at java.lang.Class.initializeClass(linux) >> ...8 more >> I added the libgcj jar to the classpath: >> export CLASSPATH=/tmp/libgcj-4.3.0.jar > > You try to native compile something. So you want to get a binary from > your application, not some links to a runtime lying somewhere... > I wonder why people always try setting the classpath. This has nothing > to do with native compilation... It's too bad GCJ also is a VM and this > has an effect even if GCJ is used for native compilation. > > > Hope this helps > Marco > > >> And now I'm getting this error: >> >> [root@tserver tmp]# ./linux >> Exception in thread "main" java.lang.NoClassDefFoundError: >> org.apache.log4j.xml.DOMConfigurator >> at java.lang.Class.initializeClass(linux) >> at java.lang.Class.newInstance(linux) >> at >> org.apache.log4j.helpers.OptionConverter.instantiateByClassName(linux) >> at org.apache.log4j.helpers.OptionConverter.selectAndConfigure(linux) >> at org.apache.log4j.LogManager.<clinit>(linux) >> at java.lang.Class.initializeClass(linux) >> at org.apache.log4j.LogManager.getLogger(linux) >> at org.apache.log4j.Logger.getLogger(linux) >> at com.flare.applications.FileSquirrel.App.main(linux) >> Caused by: java.lang.NullPointerException >> at java.net.URLClassLoader.getPermissions(linux) >> at java.security.SecureClassLoader.getProtectionDomain(linux) >> at java.security.SecureClassLoader.defineClass(linux) >> at java.net.URLClassLoader.findClass(linux) >> at java.lang.ClassLoader.loadClass(linux) >> at java.lang.ClassLoader.loadClass(linux) >> at gnu.gcj.runtime.SystemClassLoader.findClass(linux) >> at java.lang.ClassLoader.loadClass(linux) >> at java.lang.ClassLoader.loadClass(linux) >> at java.lang.Class.initializeClass(linux) >> ...8 more >> This has me really stumped and any help would be greatly appreciated. >> >> Keith >> >> >> ------------------------------------------------------------------------ >> >> ------------------------------------------------------------------------------ >> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 >> 30-Day >> trial. Simplify your report design, integration and deployment - and >> focus on >> what you do best, core application coding. Discover what's new with >> Crystal Reports now. http://p.sf.net/sfu/bobj-july >> >> >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> javaCompiler-users mailing list >> jav...@li... >> https://lists.sourceforge.net/lists/listinfo/javacompiler-users > > > > > No virus found in this incoming message. > Checked by AVG - www.avg.com > Version: 8.5.425 / Virus Database: 270.14.76/2519 - Release Date: 11/22/09 > 07:38:00 > |
From: Marco T. <ma...@mt...> - 2009-11-23 09:09:03
|
Dear Keith Keith Boynton wrote: > Hi Marco, > > Thanks for your very speedy response. > > "Please read the manual. Especially the last part of step 1. This might > already do the job" > I do apologise, I should have specified in my original history that I have > already tried the static {} references suggestion from the manual. > Unfortunately that isn't making a difference. I see... > "If not, please read through the mail archive. There were some discussions > about parts of libgcj not getting into the binary and how to solve it" > I'll have a deeper search through the archives, great news that there is > already a discussion about it. I didn't find it on my first attempts. Actually I quickly searched the archive myself but didn't find it... But I know there are discussions about it ;-) > "I wonder why people always try setting the classpath. This has nothing to > do with native compilation" > Is there not situations where this would be helpful (if indeed it does > work)? I can think of an app I would like to develop but wouldn't get a > license to distribute some of the jar dependencies and also wouldn't be > allowed to compile them into my app. Well, interesting thought. I actually never even tried if something like this works. I assume you would need to ship some parts of gcj with the binary, but I have no clue... My goal was always to get one whole binary... Have a nice day Marco > Thanks again Marco for your responses, hopefully I'll find what I need in > the archives! > > Keith > > -------------------------------------------------- > From: "Marco Trudel" <ma...@mt...> > Sent: Sunday, November 22, 2009 7:43 PM > To: "Keith Boynton" <kei...@fl...> > Cc: <jav...@li...> > Subject: Re: [jnc-users] Null PointerException > atjava.net.URLClassLoader.getPermissions > >> Dear Keith >> >> Keith Boynton wrote: >>> Hi, >>> >>> I made some good progress compiling an app I've written, I came across a >>> few errors during the first few iterations of compilation. I've been >>> able to resolve most problems I came across by adding missing >>> dependencies (jar files) for various packages I'm using. >>> >>> However I've come to a particular problem that I'm really stumped with >>> and would appreciate any help anyone could offer. >>> >>> I've compiled my app using normal methods through the UI and compilation >>> and packing seems successful. However when I run the app (windows or >>> linux, both behave the same and return the same errors) I was initially >>> getting this error: >>> >>> [root@tserver tmp]# ./linux >>> Exception in thread "main" java.lang.NoClassDefFoundError: >>> org.apache.log4j.xml.DOMConfigurator >>> at java.lang.Class.initializeClass(linux) >>> at java.lang.Class.newInstance(linux) >>> at >>> org.apache.log4j.helpers.OptionConverter.instantiateByClassName(linux) >>> at org.apache.log4j.helpers.OptionConverter.selectAndConfigure(linux) >>> at org.apache.log4j.LogManager.<clinit>(linux) >>> at java.lang.Class.initializeClass(linux) >>> at org.apache.log4j.LogManager.getLogger(linux) >>> at org.apache.log4j.Logger.getLogger(linux) >>> at com.flare.applications.FileSquirrel.App.main(linux) >>> Caused by: java.lang.ClassNotFoundException: org.xml.sax.ErrorHandler >> Please read the manual. Especially the last part of step 1. >> This might already do the job: >> static >> { >> org.xml.sax.ErrorHandler.class.getName(); >> } > > I do apologise, I should have specified in my original history that I have > already tried the static {} references suggestion from the manual. > Unfortunately that isn't making a difference. > > >> If not, please read through the mail archive. There were some >> discussions about parts of libgcj not getting into the binary and how to >> solve it (ar x libgcj and adding the objects to the compilation). >> >>> not found in gnu.gcj.runtime.SystemClassLoader{urls=[], >>> parent=gnu.gcj.runtime.ExtensionClassLoader{urls=[], parent=null}} >>> at java.net.URLClassLoader.findClass(linux) >>> at java.lang.ClassLoader.loadClass(linux) >>> at java.lang.ClassLoader.loadClass(linux) >>> at gnu.gcj.runtime.SystemClassLoader.findClass(linux) >>> at java.lang.ClassLoader.loadClass(linux) >>> at java.lang.ClassLoader.loadClass(linux) >>> at java.lang.Class.initializeClass(linux) >>> ...8 more >>> I added the libgcj jar to the classpath: >>> export CLASSPATH=/tmp/libgcj-4.3.0.jar >> You try to native compile something. So you want to get a binary from >> your application, not some links to a runtime lying somewhere... >> I wonder why people always try setting the classpath. This has nothing >> to do with native compilation... It's too bad GCJ also is a VM and this >> has an effect even if GCJ is used for native compilation. >> >> >> Hope this helps >> Marco >> >> >>> And now I'm getting this error: >>> >>> [root@tserver tmp]# ./linux >>> Exception in thread "main" java.lang.NoClassDefFoundError: >>> org.apache.log4j.xml.DOMConfigurator >>> at java.lang.Class.initializeClass(linux) >>> at java.lang.Class.newInstance(linux) >>> at >>> org.apache.log4j.helpers.OptionConverter.instantiateByClassName(linux) >>> at org.apache.log4j.helpers.OptionConverter.selectAndConfigure(linux) >>> at org.apache.log4j.LogManager.<clinit>(linux) >>> at java.lang.Class.initializeClass(linux) >>> at org.apache.log4j.LogManager.getLogger(linux) >>> at org.apache.log4j.Logger.getLogger(linux) >>> at com.flare.applications.FileSquirrel.App.main(linux) >>> Caused by: java.lang.NullPointerException >>> at java.net.URLClassLoader.getPermissions(linux) >>> at java.security.SecureClassLoader.getProtectionDomain(linux) >>> at java.security.SecureClassLoader.defineClass(linux) >>> at java.net.URLClassLoader.findClass(linux) >>> at java.lang.ClassLoader.loadClass(linux) >>> at java.lang.ClassLoader.loadClass(linux) >>> at gnu.gcj.runtime.SystemClassLoader.findClass(linux) >>> at java.lang.ClassLoader.loadClass(linux) >>> at java.lang.ClassLoader.loadClass(linux) >>> at java.lang.Class.initializeClass(linux) >>> ...8 more >>> This has me really stumped and any help would be greatly appreciated. >>> >>> Keith >>> >>> >>> ------------------------------------------------------------------------ >>> >>> ------------------------------------------------------------------------------ >>> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 >>> 30-Day >>> trial. Simplify your report design, integration and deployment - and >>> focus on >>> what you do best, core application coding. Discover what's new with >>> Crystal Reports now. http://p.sf.net/sfu/bobj-july >>> >>> >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> javaCompiler-users mailing list >>> jav...@li... >>> https://lists.sourceforge.net/lists/listinfo/javacompiler-users >> >> > > > >> No virus found in this incoming message. >> Checked by AVG - www.avg.com >> Version: 8.5.425 / Virus Database: 270.14.76/2519 - Release Date: 11/22/09 >> 07:38:00 >> > > ------------------------------------------------------------------------------ > Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day > trial. Simplify your report design, integration and deployment - and focus on > what you do best, core application coding. Discover what's new with > Crystal Reports now. http://p.sf.net/sfu/bobj-july > _______________________________________________ > javaCompiler-users mailing list > jav...@li... > https://lists.sourceforge.net/lists/listinfo/javacompiler-users |
From: Keith B. <kei...@fl...> - 2009-11-26 08:45:40
|
Hi Marco, I think I may be making "some" progress and I have a feeling this may be the thread you are talking about: http://sourceforge.net/mailarchive/forum.php?thread_name=46E7A0BF.2060301%40gmx.ch&forum_name=javacompiler-users More specifically I'm guessing this part of the thread is what could well be relevant: "lets just try to manually include all xml objects into the binary: 1. create a temporary folder. e.g. d:\test 2. open "cmd" and change into that folder 3. extract all objects from libgcj.a (run in cmd): path_to\gcc-122233-win\bin\ar.exe x path_to\gcc-122233-win\lib\libgcj.a 4. Delete all extracted files that have no "xml" in the name (you know how to do that automatically, right?) 5. Now remove the two files I sent you before and instead, in step 3 in the GUI, add the directory: d:\test\* With this procedure, you've the complete XML support in your binary. If everything works, you might want to try to remove some of the objects (if the application still works without them, they're not needed)..." Now, no matter what I do it doesn't seem to increase the size of the binary (and I get the same error), so I'm guessing I'm doing something wrong to get them added. I performed steps 1, 2 and 3 no problem. I skipped step 4 for now. I've tried step 5 although as I say it didn't increase the size of the binary so I'm assuming nothing extra made it into the binary. One thing I did notice is that your instructions suggest adding the directory "d:\test\*" however, adding \* seems to be impossible using your GUI as the directory browsing dialog simply removes it. If it navigate to the said directory using the dialog and then manually add the \* (or /*) it simply get's removed. Another interesting note is that, if I add the options as custom GCJ options like; org.xml.sax.driver.o it simply fails with cannot find file. But if I add the option as c:\temp\templib\org.xml.sax.driver.o it doesn't complain but nothing seems to be added to the binary. I feel I'm really close but either something is wrong or I'm missing something fundamental. I'm using your latest GUI with GCC downloaded from your site. Here's the GUI settings that may be relevant: Step 1 Files: None Directories: c:\temp\templib Archives: filesquirrel.jar, flaresdk.jar, smtp.jar, dsn.jar, log4j-1.2.13.jar, dom4j-1.6.1.jar, commons-io.1.2.jar, mailapi.jar, pop3.jar, imap.jar. (All with checkbox ticked for complete compilation). Step 2 Main class: com.flare.applications.FileSquirrel.App java.library.path: None Use CNI: Ticked Omit stripping, omit packing, disable optimization all not ticked Step 3 Custom GCJ Flags C:\temp\templib\javax.xml.parsers.DocumentBuilderFactory.o C:\temp\templib\javax.xml.parsers.SAXParserFactory.o C:\temp\templib\javax.xml.parsers.TransformerFactory.o C:\temp\templib\org.relaxng.datatype.DatatypeLibraryFactory.o C:\temp\templib\org.xml.sax.driver.o -findirect-dispatch Exclude GUI, Exclude JCE, Add GNU regex all ticked Compilation and packing executes just fine, however I still get the Caused by: java.lang.ClassNotFoundException: org.xml.sax.EntityResolver not found exception. Obviously I'm still fighting it, but any pointers would be greatly appreciated. Keith |
From: Marco T. <ma...@mt...> - 2009-11-26 08:56:23
|
Dear Keith Keith Boynton wrote: > Hi Marco, > > I think I may be making "some" progress and I have a feeling this may be > the thread you are talking about: > http://sourceforge.net/mailarchive/forum.php?thread_name=46E7A0BF.2060301%40gmx.ch&forum_name=javacompiler-users > > > More specifically I'm guessing this part of the thread is what could > well be relevant: > > "lets just try to manually include all xml objects into the binary: > > 1. create a temporary folder. e.g. d:\test > 2. open "cmd" and change into that folder > 3. extract all objects from libgcj.a (run in cmd): > path_to\gcc-122233-win\bin\ar.exe x path_to\gcc-122233-win\lib\libgcj.a > 4. Delete all extracted files that have no "xml" in the name (you know > how to do that automatically, right?) > 5. Now remove the two files I sent you before and instead, in step 3 in > the GUI, add the directory: d:\test\* > > With this procedure, you've the complete XML support in your binary. If > everything works, you might want to try to remove some of the objects > (if the application still works without them, they're not needed)..." Exactly what I was talking about. > Now, no matter what I do it doesn't seem to increase the size of the > binary (and I get the same error), so I'm guessing I'm doing something > wrong to get them added. > > I performed steps 1, 2 and 3 no problem. I skipped step 4 for now. Yep, that's what I would have suggested (skipping step 4 for now). > I've tried step 5 although as I say it didn't increase the size of the > binary so I'm assuming nothing extra made it into the binary. > > One thing I did notice is that your instructions suggest adding the > directory "d:\test\*" however, adding \* seems to be impossible using > your GUI as the directory browsing dialog simply removes it. If it > navigate to the said directory using the dialog and then manually add > the \* (or /*) it simply get's removed. It has to be added as custom GCJ option, not as source directory. > Another interesting note is that, if I add the options as custom GCJ > options like; org.xml.sax.driver.o it simply fails with cannot find > file. Well, it's GCJ. It doesn't know what to do with org.xml.sax.driver.o. Of course you have to specify the directory. > But if I add the option as c:\temp\templib\org.xml.sax.driver.o it > doesn't complain but nothing seems to be added to the binary. As said in Step 5, please add "C:\temp\templib\*" so you're sure all libgcj object will be included. This should result in a way bigger executable. Also you can check the compilation output to see if the flag was used. > I feel I'm really close but either something is wrong or I'm missing > something fundamental. > > I'm using your latest GUI with GCC downloaded from your site. > > Here's the GUI settings that may be relevant: > > Step 1 > Files: None > Directories: c:\temp\templib > Archives: filesquirrel.jar, flaresdk.jar, smtp.jar, dsn.jar, > log4j-1.2.13.jar, dom4j-1.6.1.jar, commons-io.1.2.jar, mailapi.jar, > pop3.jar, imap.jar. (All with checkbox ticked for complete compilation). > > Step 2 > Main class: com.flare.applications.FileSquirrel.App > java.library.path: None > Use CNI: Ticked Why? Don't tick that unless you really know what you're doing. > Omit stripping, omit packing, disable optimization all not ticked I would omit packing for now, it only takes a lot of time. > Step 3 > Custom GCJ Flags > C:\temp\templib\javax.xml.parsers.DocumentBuilderFactory.o > C:\temp\templib\javax.xml.parsers.SAXParserFactory.o > C:\temp\templib\javax.xml.parsers.TransformerFactory.o > C:\temp\templib\org.relaxng.datatype.DatatypeLibraryFactory.o > C:\temp\templib\org.xml.sax.driver.o > -findirect-dispatch Well, adding indirect-dispatch can lead to objects not included. There might be the source of the problem. But I guess you need it because of all the Jar archives you're using. > Exclude GUI, Exclude JCE, Add GNU regex all ticked Untick them all for testing purposes now. Otherwise you get mutliple references errors. Hope that helps Marco > Compilation and packing executes just fine, however I still get the > Caused by: java.lang.ClassNotFoundException: org.xml.sax.EntityResolver > not found exception. > > Obviously I'm still fighting it, but any pointers would be greatly > appreciated. > > Keith |
From: Keith B. <kei...@fl...> - 2009-11-26 20:53:48
|
Bingo! Marco, you are a diamond, so far so good..... I haven't yet performed extensive testing so I'm sure there will be some further issues but it is executing successfully now. Incidentally I think part of the solution was that I had it caching the compiled jars, I switched that off and removed the old object files so everything was recompiled. I was also confused about the custom GCJ option and had been searching for a -switch. When, of course you specify it just like a .o file with no switch! For the record (as I know how frustrating it can be to find a thread and it not end in a solution) here are the settings that are now working (so far). All jars are the same as before, all checked so they are fully compiled. Use CNI is now not checked. Omit packing is now checked. Custom GCJ Flags: c:\temp\templib\* and -findirect-dispatch Don't cache compiled jars is now checked I'm having problems getting the XML to validate against the schema (or rather for the parser to find the .xsd) but there are no exceptions getting thrown and it's executing. Appreciate your time Marco! Keith |
From: Keith B. <kei...@fl...> - 2009-11-27 20:45:07
|
Hi again Marco, The journey continues.... Further down the road and I discover I need to plug Jaxen in and I come across the dreaded multiple definition errors. Other than pulling them out of jaxen.jar I read this.... "I'm pretty sure the solution was to use -fenable-multiple-definitions or so... Please check the mailing list archive... Marco" On further investigation, I cannot see that "enable-multiple-definitions" is correct. However, GCJ does have a flag "--allow-multiple-definition". Problem is adding "--allow-multiple-definition" as a custom GCJ flag gives the following error: cc1.exe: error: unrecognized command line option "-fallow-multiple-definition" What should I be adding in the Custom GCJ flags section to set this flag? Keith |
From: Marco T. <ma...@mt...> - 2009-11-28 11:59:02
|
Dear Keith It would of course be better to resolve the multiple definitions (shouldn't be too hard, just remove them from the jaxen jar), but you can also do it with the gcc flag as you have tried. What you're looking for is -Wl,--allow-multiple-definition It's a linker option, so "-Wl" is needed so that gcc/gcj knows it has to pass the "--allow-multiple-definition" to the linker. Hope that helps Marco Keith Boynton schrieb: > Hi again Marco, > > The journey continues.... > > Further down the road and I discover I need to plug Jaxen in and I come > across the dreaded multiple definition errors. Other than pulling them > out of jaxen.jar I read this.... > > "I'm pretty sure the solution was to use -fenable-multiple-definitions or > so... Please check the mailing list archive... > Marco" > > On further investigation, I cannot see that > "enable-multiple-definitions" is correct. However, GCJ does have a flag > "--allow-multiple-definition". > > Problem is adding "--allow-multiple-definition" as a custom GCJ flag > gives the following error: > cc1.exe: error: unrecognized command line option > "-fallow-multiple-definition" > > What should I be adding in the Custom GCJ flags section to set this flag? > > Keith |
From: Keith B. <kei...@fl...> - 2009-12-03 09:21:54
|
Hi Marco, That certainly does help, I'm a little further down the road and am battling with the following error now. Exception in thread "main" java.lang.NoClassDefFoundError: java.text.DecimalFormat at gnu.xml.transform.Stylesheet.initDefaultDecimalFormat(win32.exe) I've asked a few questions on the java-gcc mailing list, they've been very helpful and have suggested the following: #copy libgcj to a working dir (could be in a different location than /usr/lib/ for you) mkdir -p /tmp/mess_with_libgcj cd /tmp/mess_with_libgcj cp /usr/lib/libgcj.a . #extract all the object from this library ar x libgcj.a #make a lib with only the properties objects ar rvcs libgcj_properties.a *properties*.o #do the (sometimes superfluous) blessing of the lib ranlib libgcj_properties.a #copy the lib to the system lib dir cp libgcj_properties.a /usr/lib/ #goto your source project and this time link-in those properties objects with --whole-archive, this forces the linker to include them even if they aren't statically referenced cd <your source build-tree> *gcj* -o <your prog> -Wl,--whole-archive -lgcj_properties -Wl,--no-whole-archive -static-libgcj --main=<your main> Now, I've tried add the flags (-Wl,--whole-archive -lgcj_properties -Wl,--no-whole-archive) to the Custom GCJ flags section. However I can't seem to add them in the correct order. JNC seems to re-order them for me and it ends up: -Wl,--whole-archive -Wl,--no-whole-archive -lgcj_properties Is this a restriction or am I missing something? Keith |
From: Marco T. <ma...@mt...> - 2009-12-03 09:31:39
|
Dear Keith Pleas read my previous mail again and do what I wrote there (extract libgcj.a (e.g. to "D:\only_libgcj_tmp") and add all objects to the compilation (flag "D:\only_libgcj_tmp\*")). This way - as already said - all libgcj objects will end up in your binary and you can test if it works. If it does, you can slowly remove the object you don't need (or the other way around). You seem to have made your live unnecessary complicated with the current problem :-( The solution to the xml problem already solved this... Ah yeah, if you're working on Linux, the "*" will not work in "D:\only_libgcj_tmp\*". So you might want to edit the JNC config file yourself and add all objects to it. Hope that helps Marco Keith Boynton wrote: > Hi Marco, > > That certainly does help, I'm a little further down the road and am > battling with the following error now. > > Exception in thread "main" java.lang.NoClassDefFoundError: > java.text.DecimalFormat > at gnu.xml.transform.Stylesheet.initDefaultDecimalFormat(win32.exe) > > I've asked a few questions on the java-gcc mailing list, they've been > very helpful and have suggested the following: > > #copy libgcj to a working dir (could be in a different location than > /usr/lib/ for you) > mkdir -p /tmp/mess_with_libgcj > cd /tmp/mess_with_libgcj > cp /usr/lib/libgcj.a . > > #extract all the object from this library > ar x libgcj.a > > #make a lib with only the properties objects > ar rvcs libgcj_properties.a *properties*.o > #do the (sometimes superfluous) blessing of the lib > ranlib libgcj_properties.a > > #copy the lib to the system lib dir > cp libgcj_properties.a /usr/lib/ > > #goto your source project and this time link-in those properties objects > with --whole-archive, this forces the linker to include them even if > they aren't statically referenced > cd <your source build-tree> > *gcj* -o <your prog> -Wl,--whole-archive -lgcj_properties > -Wl,--no-whole-archive -static-libgcj --main=<your main> > > > > Now, I've tried add the flags (-Wl,--whole-archive -lgcj_properties > -Wl,--no-whole-archive) to the Custom GCJ flags section. However I can't > seem to add them in the correct order. JNC seems to re-order them for me > and it ends up: > -Wl,--whole-archive -Wl,--no-whole-archive -lgcj_properties > > Is this a restriction or am I missing something? > > Keith |
From: Keith B. <kei...@fl...> - 2009-12-03 09:57:12
|
Hi Marco, You're too fast at replying. Sorry I should have made myself more clear. I have done your suggestion and that is the error that I get now I've done as you said. Here's a dump of the options that give me this error: gcc-122233-win\bin\gcj --main=com.flare.applications.FileSquirrel.App -fjni -Djava.library.path=lib -Dsun.java2d.fontpath= -Djava.home=. -Djava.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment -Dawt.toolkit=sun.awt.windows.WToolkit -Dsun.io.unicode.encoding=UnicodeLittle -Llibs/win -Ilibs/win/gui/gui.jar -oC:\JavaNC\projects\FileSquirrel\compiled\filesquirrel.exe -s -O2 C:\JavaNC\projects\FileSquirrel\lib\* -Wl,--allow-multiple-definition -findirect-dispatch -ljncTrial -IC:\Users\Keith Boynton\Documents\EclipseWorkspace\File Squirrel\bin\fileSquirrel.jar -IC:\Users\Keith Boynton\Documents\EclipseWorkspace\FlareSDK\bin\flaresdk.jar -IC:\JavaNC\projects\FileSquirrel\jars\imap.jar -IC:\JavaNC\projects\FileSquirrel\jars\smtp.jar -IC:\JavaNC\projects\FileSquirrel\jars\dsn.jar -IC:\JavaNC\projects\FileSquirrel\jars\pop3.jar -IC:\JavaNC\projects\FileSquirrel\jars\commons-io-1.2.jar -IC:\JavaNC\projects\FileSquirrel\jars\jaxen-1.1.jar -IC:\JavaNC\projects\FileSquirrel\jars\mailapi.jar -IC:\JavaNC\projects\FileSquirrel\jars\log4j-1.2.13.jar -IC:\JavaNC\projects\FileSquirrel\jars\dom4j-1.6.1.jar @C:\Users\KEITHB~1\AppData\Local\Temp\JNCTempnmusjg.out\SourceListnmusjh.list Note. C:\JavaNC\projects\FileSquirrel\lib\* is the location where I extracted the objects to (it was c:\temp\templib\* in our previous discussions). Doing your suggestion did get me past the previous NoClassDefFound error (org.xml.sax.EntityResolver) but now I'm battling with this one: Exception in thread "main" java.lang.NoClassDefFoundError: java.text.DecimalFormat at gnu.xml.transform.Stylesheet.initDefaultDecimalFormat The GCJ folks reckon it was something to do with the properties objects hence their suggestion: http://gcc.gnu.org/ml/java/2009-11/msg00084.html I appreciate your time Marco, especially as I know you've discontinued your work on JNC for now. Keith |
From: Marco T. <ma...@mt...> - 2009-12-03 10:04:25
|
Dear Keith Then the problem is more complicated and requires a closer look at the compilation and the GCJ source... So I'm afraid I can't help you since, as you already discovered, I discontinued JNC. Of course you could also try to use another xml library... Sorry for the bad news Marco Keith Boynton wrote: > Hi Marco, > > You're too fast at replying. Sorry I should have made myself more clear. > I have done your suggestion and that is the error that I get now I've > done as you said. > > Here's a dump of the options that give me this error: > > gcc-122233-win\bin\gcj > --main=com.flare.applications.FileSquirrel.App > -fjni > -Djava.library.path=lib > -Dsun.java2d.fontpath= > -Djava.home=. > -Djava.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment > -Dawt.toolkit=sun.awt.windows.WToolkit > -Dsun.io.unicode.encoding=UnicodeLittle > -Llibs/win > -Ilibs/win/gui/gui.jar > -oC:\JavaNC\projects\FileSquirrel\compiled\filesquirrel.exe > -s > -O2 > C:\JavaNC\projects\FileSquirrel\lib\* > -Wl,--allow-multiple-definition > -findirect-dispatch > -ljncTrial > -IC:\Users\Keith Boynton\Documents\EclipseWorkspace\File > Squirrel\bin\fileSquirrel.jar > -IC:\Users\Keith > Boynton\Documents\EclipseWorkspace\FlareSDK\bin\flaresdk.jar > -IC:\JavaNC\projects\FileSquirrel\jars\imap.jar > -IC:\JavaNC\projects\FileSquirrel\jars\smtp.jar > -IC:\JavaNC\projects\FileSquirrel\jars\dsn.jar > -IC:\JavaNC\projects\FileSquirrel\jars\pop3.jar > -IC:\JavaNC\projects\FileSquirrel\jars\commons-io-1.2.jar > -IC:\JavaNC\projects\FileSquirrel\jars\jaxen-1.1.jar > -IC:\JavaNC\projects\FileSquirrel\jars\mailapi.jar > -IC:\JavaNC\projects\FileSquirrel\jars\log4j-1.2.13.jar > -IC:\JavaNC\projects\FileSquirrel\jars\dom4j-1.6.1.jar > > @C:\Users\KEITHB~1\AppData\Local\Temp\JNCTempnmusjg.out\SourceListnmusjh.list > > > > Note. C:\JavaNC\projects\FileSquirrel\lib\* is the location where I > extracted the objects to (it was c:\temp\templib\* in our previous > discussions). > > Doing your suggestion did get me past the previous NoClassDefFound error > (org.xml.sax.EntityResolver) but now I'm battling with this one: > Exception in thread "main" java.lang.NoClassDefFoundError: > java.text.DecimalFormat > at gnu.xml.transform.Stylesheet.initDefaultDecimalFormat > > The GCJ folks reckon it was something to do with the properties objects > hence their suggestion: > http://gcc.gnu.org/ml/java/2009-11/msg00084.html > > I appreciate your time Marco, especially as I know you've discontinued > your work on JNC for now. > > Keith |
From: Keith B. <kei...@fl...> - 2009-12-03 10:53:53
|
Indeed, so am I correct though that it is impossible to control the order of the Custom GCJ Flags in JNC? |
From: Marco T. <ma...@mt...> - 2009-12-03 11:33:04
|
Keith Boynton wrote: > Indeed, so am I correct though that it is impossible to control the > order of the Custom GCJ Flags in JNC? I don't remember how I implemented it, sorry. So if the order in the GUI is not maintained in the compilation, then you could adapt the sources for the GUI frontend. Shouldn't be too hard... But I think you're trying to ride a dead horse here. You already have all objects in your binary. You have nothing else to add that might help... Hope that helps Marco |
From: Keith B. <kei...@fl...> - 2009-12-03 12:42:25
|
Thanks very much for your time Marco, I'll update this thread when I do find whatever the solution is. It could well be simply switching to another parser! Keith |