RE: a question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dear All,
To avoid the dependency of the binary on any other files so i compiled but with the static linking option , is it sufficient ? the binary now is larger as andrew said , but when i run the binary the following error is appeared :
2009-07-10 19:57:47.608::INFO:  Logging to STDERR via org.mortbay.log.StdErrLog
Exception in thread "main" java.lang.ExceptionInInitializerError
  at java.lang.Class.initializeClass(Unknown Source)
  at gnu.java.util.regex.RE.getLocalizedMessage(Unknown Source)
  at gnu.java.util.regex.RESyntax.(Unknown Source)
  at java.lang.Class.initializeClass(Unknown Source)
  at java.util.regex.Pattern.(Unknown Source)
  at java.util.regex.Pattern.compile(Unknown Source)
  at java.util.regex.Pattern.compile(Unknown Source)
  at java.net.URI.(Unknown Source)
  at java.lang.Class.initializeClass(Unknown Source)
  at java.io.File.toURI(Unknown Source)
  at org.mortbay.resource.Resource.newResource(Resource.java:151)
  at org.mortbay.resource.Resource.newResource(Resource.java:120)
  at org.mortbay.jetty.handler.ResourceHandler.setResourceBase(ResourceHandler.java:98)
  at it.unitn.disi.sweb.webinterface.application.Main.main(Unknown Source)
Caused by: java.util.MissingResourceException: Bundle
gnu/java/util/regex/MessagesBundle not found
  at java.util.ResourceBundle.getBundle(Unknown Source)
  at java.util.ResourceBundle.getBundle(Unknown Source)
  at gnu.java.util.regex.RE.(Unknown Source)
  at java.lang.Class.initializeClass(Unknown Source)
  ...13 more
 
i use gcc 4.2.5 when i compile it with a later gcj version 4.4.0 and run , the error is diffrent  :
 Exception in thread "main" java.lang.ExceptionInInitializerError
  at java.lang.Class.initializeClass(Unknown Source)
  at java.lang.Class.initializeClass(Unknown Source)
  at java.text.SimpleDateFormat.(Unknown Source)
  at java.text.SimpleDateFormat.(Unknown Source)
  at org.mortbay.util.DateCache.setTimeZone(DateCache.java:124)
  at org.mortbay.util.DateCache.(DateCache.java:85)
  at org.mortbay.log.StdErrLog.(StdErrLog.java:36)
  at java.lang.Class.initializeClass(Unknown Source)
  at java.lang.Class.forName(Unknown Source)
  at java.lang.Class.forName(Unknown Source)
  at org.mortbay.log.Log.class$(Log.java:52)
  at org.mortbay.log.Log.(Log.java:57)
  at java.lang.Class.initializeClass(Unknown Source)
  at org.mortbay.component.Container.add(Container.java:200)
  at org.mortbay.component.Container.update(Container.java:164)
  at org.mortbay.component.Container.update(Container.java:106)
  at org.mortbay.jetty.Server.setConnectors(Server.java:149)
  at org.mortbay.jetty.Server.addConnector(Server.java:123)
  at it.unitn.disi.sweb.webinterface.application.Main.main(Unknown Source)
Caused by: java.lang.NullPointerException
  at java.io.InputStreamReader.read(Unknown Source)
  at java.io.BufferedReader.fill(Unknown Source)
  at java.io.BufferedReader.readLine(Unknown Source)
  at java.util.Properties.load(Unknown Source)
  at java.util.Properties.load(Unknown Source)
  at java.util.Calendar.(Unknown Source)
  at java.lang.Class.initializeClass(Unknown Source)
  ...18 more
Andrew , is this true way to make a binary that can run without libgcj and jar files libraries or  it is better to use the way that you illustrated , and if  yes , please  tell me some details  .
Many Thanks ,Mohamed Hegazy
> Date: Fri, 10 Jul 2009 17:28:26 +0100
> From: aph@xxxxxxxxxx
> To: engmohheg@xxxxxxxxxxx
> CC: gcc-help@xxxxxxxxxxx
> Subject: Re: a question
> 
> mohammed hegazy wrote:
>  i want to ask a question about gcj output binary ,is the binary
>> depends on the jre
> 
> You'll still need libgcj, the Java runtime library, unless you
> precompile everything and link the whole lot statically.
> 
>> or the jre can be removed , and about the CLASSPATH variable , is it
>> must set? , and if the compilation is used with static linking if in
>> this case , the dependent jar libraries could be removed or not ?.
> 
> They could be, yes, but it's trick and you'll end up with a very large
> executable.  The trick is to compile all the libraries into .a files
> and then like them all together with --whole-archive.  There are more
> subtle ways to do it, but this will usually work.
> 
> Andrew.

_________________________________________________________________
More than messages–check out the rest of the Windows Live™.
http://www.microsoft.com/windows/windowslive/

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux