netbeans-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Neffenger <j...@status6.com>
Subject Re: Building NetBeans 11.1 from source fails with compile errors
Date Sat, 05 Oct 2019 16:04:04 GMT
On 10/4/19 12:27 PM, Neil C Smith wrote:
> After making sure both java -version and javac -version give 8,
> cd into the netbeans directory and run `ant` as per
> http://netbeans.apache.org/download/dev/index.html
Thank you, Neil. That prompted me to figure out how I got off to such a 
bad start. It was JAVA_HOME.

I think it went like this ...

I made sure, as you suggest, to have the correct JDK and Ant versions on 
my PATH:

   $ which java; java -version
   /usr/bin/java
   openjdk version "1.8.0_222"
   OpenJDK Runtime Environment
     (build 1.8.0_222-8u222-b10-1ubuntu1~16.04.1-b10)
   OpenJDK 64-Bit Server VM (build 25.222-b10, mixed mode)

   $ which javac; javac -version
   /usr/bin/javac
   javac 1.8.0_222

   $ which ant; ant -version
   /home/john/opt/apache-ant-1.10.7/bin/ant
   Apache Ant(TM) version 1.10.7 compiled on September 1 2019

But when I ran the build, I got compilation errors:

   $ ant
   ...
   [javac] 
/home/john/tmp/netbeans/nbbuild/build/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/platform/JDKPlatformProvider.java:120:

error: reference to newFileSystem is ambiguous
   [javac] ctSym2FileSystem.put(file, fs = 
FileSystems.newFileSystem(file, null));
   [javac]                                            ^
   [javac] both method newFileSystem(Path,ClassLoader) in FileSystems 
and method newFileSystem(Path,Map<String,?>) in FileSystems match
   [javac] 4 errors
   [javac] 9 warnings

   BUILD FAILED
   ...
   Total time: 16 seconds

The compilation errors were due to Ant using the JDK commands defined by 
the JAVA_HOME environment variable instead of the ones on my PATH:

   $ ant -diagnostics | grep java.version
   ant.java.version: 13
   java.version : 13
   java.version.date : 2019-09-17

And JAVA_HOME was defined because I'm building NetBeans on my 
development workstation instead of on a separate build machine as I do 
for JavaFX and the JDK.

I think "mlist" had a similar problem with ANT_HOME, which will cause 
the "ant" command on your PATH to transform itself into whatever version 
is defined by the environment variable! Setting all these environment 
variables explicitly in a simple Bash script solved the problems for 
both of us.

In retrospect, it would be nice to have a fourth item on the page you 
linked:

   Apache NetBeans source and daily builds
   https://netbeans.apache.org/download/dev/index.html

   Building from source

   You can of course build Apache NetBeans from source. To do so:

   1. Clone the https://github.com/apache/netbeans GitHub repository.
   2. Install Oracle’s Java or Open JDK (v8, v11).
   3. Install Apache Ant 1.10 or greater (https://ant.apache.org/).
   4. Unset JAVA_HOME and ANT_HOME, or set them both appropriately.

Thanks again,
John


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@netbeans.apache.org
For additional commands, e-mail: dev-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists




Mime
View raw message