cannot figure out how to use gcj of the gcc

David Daney ddaney@avtrex.com
Tue Jul 3 20:27:00 GMT 2007


hill0093 wrote:
> When I run 
> gcj --main=Program  Program.class
> in the directory where all the dependent classes are,
> except the imports from the standard libraries,
> it doesn’t seem to pick up the dependent classes.
> But when I run
> gcj --main=Program  Program.java
> in the same directory,
> it seems to pick up the dependent classes.
> Does that seem right?
> 

I don't want to analyze the righteousness  of gcj, but I can confirm 
that you are seeing the expected behavior.  If you want more than a 
single class linked, list them all.


> Also I have another program that uses only imported classes
> and that gives the same error
> Java.Lang.UnsupportedOperationException
> whether I use either of the above gcj commands, 
> but it runs in Windows using the sun Java1.5 SDK
> under JCreator LE.
> The surprising thing to me is that gcj doesn’t tell
> me where error came from, no line numbers, no clue.
> What do I do?

As is documented here:

http://gcc.gnu.org/onlinedocs/gcj/libgcj-Runtime-Properties.html#libgcj-Runtime-Properties

You can set the gnu.gcj.runtime.NameFinder.use_addr2line system property 
to true and you might get line numbers.

If that does not produce the line numbers, the you are in the 
unfortunate situation that your libgcj has had the debugging information 
stripped out of it.

The source code to libgcj is available from the same place you got 
libgcj, so you can look at it and fix it if you desire.

If you cannot fix it, follow the other options I suggested in the other 
e-mail.

> 
> However, a consolation is that yet another simpler
> program runs under both systems.
> public class HelloJav { 
>   public static void main(String[] args) { 
>     System.out.println("HelloJav"); 
> } }
> No imports, no dependent classes.
> 
> Another thing that bothers me is that the gcc-java forum
> seems to be dead.

I am not familiar with that forum.  But mail sent to java@gcc.gnu.org 
will be answered in short order.

> Does any one use Java?

I do.  So do many others.

> I feel way out in left field.

I am sorry to hear that.

David Daney



More information about the Gcc-help mailing list