public inbox for java@gcc.gnu.org
 help / color / mirror / Atom feed
* Error when trying to run java program with gij
@ 2002-04-18 15:06 Per-Olof Wallin
  2002-04-19  1:13 ` Tom Tromey
  0 siblings, 1 reply; 4+ messages in thread
From: Per-Olof Wallin @ 2002-04-18 15:06 UTC (permalink / raw)
  To: java

Hi

I've just compiled and installed gcc 3.0.4 on my Solaris2.8. I can compile the
program with gcj but when I try to run by: >gij program

I get the message:

>>Exception in thread "main" java.lang.ClassNotFoundException: hello

I have previously gotten this message when using jdk under Windows but have been
able to solve that problem. Now I don't seem to be able to solve it on my
Solaris-machine.
I have jdk 1.3 installed on my Solaris-machine and the program works fine when
using "java" and "javac".

Can someone please help me?

Thanks,

Per-Olof Wallin

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Error when trying to run java program with gij
  2002-04-18 15:06 Error when trying to run java program with gij Per-Olof Wallin
@ 2002-04-19  1:13 ` Tom Tromey
  2002-04-19  7:20   ` Per-Olof Wallin
  0 siblings, 1 reply; 4+ messages in thread
From: Tom Tromey @ 2002-04-19  1:13 UTC (permalink / raw)
  To: Per-Olof Wallin; +Cc: java

>>>>> "Per-Olof" == Per-Olof Wallin <perwal-6@student.luth.se> writes:

Per-Olof> I've just compiled and installed gcc 3.0.4 on my
Per-Olof> Solaris2.8. I can compile the program with gcj but when I
Per-Olof> try to run by: >gij program

>>> Exception in thread "main" java.lang.ClassNotFoundException: hello

Try setting your CLASSPATH environment variable to point to where
`hello.class' is found.

Tom

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Error when trying to run java program with gij
  2002-04-19  1:13 ` Tom Tromey
@ 2002-04-19  7:20   ` Per-Olof Wallin
  2002-04-19 11:06     ` Tom Tromey
  0 siblings, 1 reply; 4+ messages in thread
From: Per-Olof Wallin @ 2002-04-19  7:20 UTC (permalink / raw)
  To: java

> Try setting your CLASSPATH environment variable to point to where
> `hello.class' is found.

Sorry, I forgot to mention that. I'd already done that, but it didn't work.
Any other suggestions?


Also let me make an addition and make it clear what I have done. Someone thought
it wasn't clear what I'd done.
I compiled my program, the classic Hello World-program, with gcj into a class
file: >>gcj -C hello.java. 
That works fine but when trying to run with gij: >>gij hello, I get an error
message:

>> Exception in thread "main" java.lang.ClassNotFoundException: hello

If I try to run the compiled class-file using jdk 1.3: >>java hello, the program
works fine.

The program I'm trying to run is sitting in a file called hello.java:
public class hello{
        public static void main(String argv[]) {
                System.out.println("Hello World!");
        }
}


Additional problem:
Today I've also tried compiling the program into object files using: >>gcj
hello.java and >>gcj hello.class, but neither of the commands work. I get the
message:

>>Undefined                       first referenced
>> symbol                             in file
>>main                               
>>/users/pwallin/gcc/3.0.4/lib/gcc-lib/sparc-sun-solaris2.8/3.0.4/crt1.o
>>ld: fatal: Symbol referencing errors. No output written to a.out
>>collect2: ld returned 1 exit status


Thanks for any help.

/Per-Olof Wallin

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Error when trying to run java program with gij
  2002-04-19  7:20   ` Per-Olof Wallin
@ 2002-04-19 11:06     ` Tom Tromey
  0 siblings, 0 replies; 4+ messages in thread
From: Tom Tromey @ 2002-04-19 11:06 UTC (permalink / raw)
  To: Per-Olof Wallin; +Cc: java

>>>>> "Per-Olof" == Per-Olof Wallin <perwal-6@student.luth.se> writes:

>>> Exception in thread "main" java.lang.ClassNotFoundException: hello

Per-Olof> Today I've also tried compiling the program into object
Per-Olof> files using: >>gcj hello.java and >>gcj hello.class, but
Per-Olof> neither of the commands work. I get the message:

>>> Undefined                       first referenced
>>> symbol                             in file
>>> main                               

This is a FAQ.  You have to use the `--main' option, like this:

    gcj -o hello --main=hello hello.java

>>> /users/pwallin/gcc/3.0.4/lib/gcc-lib/sparc-sun-solaris2.8/3.0.4/crt1.o

You didn't tell us you were on Sparc.  The bytecode interpreter
doesn't work on Sparc; no one has ported it.

Tom

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2002-04-19 18:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-18 15:06 Error when trying to run java program with gij Per-Olof Wallin
2002-04-19  1:13 ` Tom Tromey
2002-04-19  7:20   ` Per-Olof Wallin
2002-04-19 11:06     ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).