Yeah it's my first shot at Java. I managed to successfully build a small app which used ten or so classes but they were all in the one file. It's breaking things into individual files which has thrown me.
So basically I need compile MyClass first, then compile and link App.
I removed the import/package keywords like you said, put them into one dir and gave it a shot but this happened:
Code: Select all
[d11wtq@pc-cac Foo]$ gcj -c MyClass.java && gcj --main=App App.java
/tmp/ccGkfXS3.o: In function `App::main(JArray<java::lang::String*>*)':
App.java:(.text+0x16): undefined reference to `MyClass::class$'
App.java:(.text+0x25): undefined reference to `MyClass::MyClass()'
collect2: ld returned 1 exit status
[d11wtq@pc-cac Foo]$ ls
App.java MyClass.java MyClass.o
[d11wtq@pc-cac Foo]$
It's obvious I don't know what I'm doing having been programming just about nothing but PHP/JavaScript for the past 3 years

I'm not overly understanding of how compilers actually work (e.g. what the compiler does and what the linker does).
Did what I did above basically make an object file for MyClass and then try to compile and link App.java?
EDIT | I haven't set any environment variables. I've seen CLASSPATH used a lot but the compiler seems to find my files ok without that for now.