1 Common Issues
1.1 Java heap space issues
If you run across an error like the following:
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space at org.eclipse.jdt.internal.compiler. etc...
This means that your copy of ecj is running on a Java VM which has not been allocated enough heap space to successfully compile the classes in IcedTea. Many Java VMs, including Sun's, set a maximum limit on the size of the heap. Java-based compilers like ecj and javac can exceed this (the same problem occurs when building GNU Classpath). Many distributions setup ecj to run with a script using something along the lines of:
To this, you should add the option -Xmx512M after java like so:
java -Xmx512M org.eclipse.jdt.internal.compiler.batch.Main
This will increase the maximum size of the heap to 512MB which should be sufficient. Note that the IcedTea build does this, so this problem only usually occurs when building with ecj. Distributions that ship a version of ecj which uses gcj (either natively or via gij) will also not encounter this problem, as gcj has no such maximum heap size.
1.2 Lacking a valid JDK
If you get the message:
ERROR: Your BOOTDIR environment variable does not point to a valid JDK for bootstrapping this build. A JDK 7 build must be bootstrapped using JDK 1.6.0 fcs (or later). Apparently, your bootstrap JDK is version 1.4 Please update your ALT_BOOTDIR setting and start your build again.
Then the problem is likely to be with the java binary symlinked in bootstrap/jdk1.6.0/bin/java. By default, this will link to gij, which on many systems is not 1.5 compliant:
bootstrap/jdk1.6.0/bin/java -version java version "1.4.2" gij (GNU libgcj) version 4.1.2 (Gentoo 4.1.2 p1.0.2)
To use gcj as the JDK, you need a version which is 1.5 compliant. Only 4.3 and later (along with RedHat's backport) of this are. Most distributions now provide this version (e.g. Fedora 8, 9 and 10, Debian Lenny, Gentoo unstable, recent Ubuntus) while with others you will need to download and compile another copy of GCC to use this. See the Gentoo build instructions for how to do this. Alternatively, you can pass the --with-java option to configure in order to make the symlink point to a different VM which is compliant.
1.3 Generics-related build errors when building the langtools
If you come across errors like the following:
-def-pcompile: [javac] Compiling 2 source files [javac] ---------- [javac] 1. ERROR [javac] List<String> sortedKeys = new ArrayList<String>(); [javac] ^^^^ [javac] The type List is not generic; it cannot be parameterized with arguments <String>
this means that the Java compiler (bootstrap/jdk1.6.0/bin/javac) being used to compile the langtools is not using a 1.5 compliant classlibrary. Again, this tends to occur if your gcj is old (see above) as the libgcj being used will then not include a version of classes such as java.util.List that use generics. Either install a newer GCC or pass a different GNU Classpath-based JDK using the --with-gcj-home option.
1.4 IcedTea7 building on systems with JDK 5 or JDK 6
If IcedTea7 build fails with following error message:
javac: invalid source release: 7 Usage: javac <options> <source files> use -help for a list of possible options make: *** [.compile.classlist] Error 2
it means you are trying to compile sources using JDK 5 or JDK6. In this case it is needed to use --disable-bootstrap flag:
hg fclone http://icedtea.classpath.org/hg/icedtea7 cd icedtea ./autogen.sh ./configure --disable-bootstrap make