gephi/trunk — Issue #14: Gephi does not build on JDK 7
Author: mbastian
Created: 2011-10-22 16:41:28+00:00
State: open
Labels: Critical, Fix Released

Like the summary says, Gephi can't be built with JDK 7.

The problem is that PDF Exporter depends on the sun.font.FontManager class, which is an "internal proprietary API", according to the build log:

Compiling 3 source files to /home/luiz/projects/bzr/gephi/PreviewExport/build/classes
warning: [options] bootstrap class path not set in conjunction with -source 1.5
/home/luiz/projects/bzr/gephi/PreviewExport/src/org/gephi/io/exporter/preview/PDFExporter.java:68: warning: FontManager is internal proprietary API and may be removed in a future release
import sun.font.FontManager;
Note: org.gephi.io.exporter.preview.ExporterBuilderPDF to be registered as a org.gephi.io.exporter.spi.VectorFileExporterBuilder
/home/luiz/projects/bzr/gephi/PreviewExport/src/org/gephi/io/exporter/preview/PDFExporter.java:68: warning: FontManager is internal proprietary API and may be removed in a future release
import sun.font.FontManager;
/home/luiz/projects/bzr/gephi/PreviewExport/src/org/gephi/io/exporter/preview/PDFExporter.java:68: warning: FontManager is internal proprietary API and may be removed in a future release
import sun.font.FontManager;
/home/luiz/projects/bzr/gephi/PreviewExport/src/org/gephi/io/exporter/preview/PDFExporter.java:467: warning: FontManager is internal proprietary API and may be removed in a future release
String fontName = FontManager.getFileNameForFontName(font.getFontName());
/home/luiz/projects/bzr/gephi/PreviewExport/src/org/gephi/io/exporter/preview/PDFExporter.java:467: error: cannot find symbol
String fontName = FontManager.getFileNameForFontName(font.getFontName());
symbol: method getFileNameForFontName(String)
location: interface FontManager
/home/luiz/projects/bzr/gephi/PreviewExport/src/org/gephi/io/exporter/preview/PDFExporter.java:469: warning: FontManager is internal proprietary API and may be removed in a future release
String fontFilePath = FontManager.getFontPath(false);
/home/luiz/projects/bzr/gephi/PreviewExport/src/org/gephi/io/exporter/preview/PDFExporter.java:469: error: cannot find symbol
String fontFilePath = FontManager.getFontPath(false);
symbol: method getFontPath(boolean)
location: interface FontManager
2 errors
6 warnings
/usr/share/netbeans/harness/common.xml:206: Compile failed; see the compiler error output for details.
BUILD FAILED (total time: 3 seconds)

If I comment the lines 467 to 472 from PDFExporter.java, everything builds just fine, so we just need to find an alternative to calling FontManager's getFileNameForFontName and getFontPath methods.