This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

copile java 1.5 code


Hello,
I need to compile a java program. This one is written with java 1.5. It does 
not work to compile the program correct.

I wrote a little program to solve my compile problems, but it still doesn't 
work. I hope someone can help me. Or is it just at the moment not possible to 
compile java 1.5 code?

The little senseless program is append to this mail.

tia

Oli

ps:
I used the comands:
tow@linux:~/benny> javac *.java
tow@linux:~/benny> gcj -g --main=Test -o Test Test.class Test2.class
Test2.java: In class `Test2':
Test2.java: In method `Test2.toString()':
Test2.java:10: error: cannot find file for class java.lang.StringBuilder
Test2.java:10: error: cannot find file for class java.lang.StringBuilder
Test2.java:10: error: cannot find file for class java.lang.StringBuilder
Test2.java:10: error: cannot find file for class java.lang.StringBuilder
Test2.java:10: error: cannot find file for class java.lang.StringBuilder
Test2.java:10: error: cannot find file for class java.lang.StringBuilder
Test2.java:10: error: cannot find file for class java.lang.StringBuilder
Test2.java:10: error: cannot find file for class java.lang.StringBuilder
Test2.java:10: error: cannot find file for class java.lang.StringBuilder
Test2.java:10: error: class 'java.lang.StringBuilder' has no method named 
'<init>' matching signature '()V'
Test2.java:10: confused by earlier errors, bailing out
tow@linux:~/benny> ls -lh
insgesamt 16K
-rw-r--r--  1 tow users 543 2005-01-26 15:01 Test2.class
-rw-------  1 tow users 166 2005-01-26 15:00 Test2.java
-rw-r--r--  1 tow users 558 2005-01-26 15:01 Test.class
-rw-------  1 tow users 341 2005-01-26 15:00 Test.java
tow@linux:~/benny>
class Test2 {

    int x, y;
    Test2(int x, int y) {
 	this.x = x;
 	this.y = y;
    }
 
    public String toString() {
 	return "x = " + x + "; y = " + y;
    }
}
import java.util.*;

class Test {
    
    public static String test() {
	return "theTest!!!";
    }

    public static void main(String[] args) {
	// einfache Ausgabe -> ja
	System.out.println("hallo Welt!");
	
	// kompatibel zu jdk 1.5? -> ja
	LinkedList<String> ll = new LinkedList<String>();
	ll.add("HALLO");
	ll.add("Who the chef!");
	Iterator<String> it = ll.iterator();
	while (it.hasNext())
	    System.out.println(it.next());

	// Methoden funktionieren -> ja
	System.out.println(test());

	// Andere Objekte einbinden -> nein, funktioniert so nicht. :-(
//	System.out.println(new Test2(5, 4));
    }
}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]