This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 213403 - Java sources cannot be compiled using Ant when running IDE on JDK 8
Summary: Java sources cannot be compiled using Ant when running IDE on JDK 8
Status: RESOLVED WONTFIX
Alias: None
Product: projects
Classification: Unclassified
Component: Ant (show other bugs)
Version: 8.0
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Tomas Stupka
URL:
Keywords: JDK_SPECIFIC
: 223808 227089 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-06-01 15:36 UTC by Petr Cyhelsky
Modified: 2016-07-07 08:39 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 948


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Petr Cyhelsky 2012-06-01 15:36:57 UTC
Product Version: NetBeans IDE Dev (Build 201205220903)
Java: 1.8.0-internal; OpenJDK Client VM 24.0-b07
System: Linux version 3.0.0-20-generic running on i386; UTF-8; en_US (nb)

Steps: run IDE with jdk 1.8 -> create new java application -> invoke build on the newly created project -> it fails andfollowing is written into the output>


/space/SampleProject/nbproject/build-impl.xml:854: The following error occurred while executing this line:
/space/SampleProject/nbproject/build-impl.xml:268: Class not found: javac1.8
	at org.apache.tools.ant.util.ClasspathUtils.newInstance(ClasspathUtils.java:257)
	at org.apache.tools.ant.taskdefs.compilers.CompilerAdapterFactory.resolveClassName(CompilerAdapterFactory.java:194)
	at org.apache.tools.ant.taskdefs.compilers.CompilerAdapterFactory.getCompiler(CompilerAdapterFactory.java:155)
	at org.apache.tools.ant.taskdefs.Javac.findSupportedFileExtensions(Javac.java:979)
	at org.apache.tools.ant.taskdefs.Javac.scanDir(Javac.java:956)
	at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:927)
	at org.netbeans.modules.java.source.ant.JavacTask.execute(JavacTask.java:144)
	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
	at sun.reflect.GeneratedMethodAccessor62.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:474)
	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
	at org.apache.tools.ant.Task.perform(Task.java:348)
	at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)
	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
	at sun.reflect.GeneratedMethodAccessor62.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:474)
	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
	at org.apache.tools.ant.Task.perform(Task.java:348)
	at org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.java:398)
	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
	at sun.reflect.GeneratedMethodAccessor62.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:474)
	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
	at org.apache.tools.ant.Task.perform(Task.java:348)
	at org.apache.tools.ant.Target.execute(Target.java:392)
	at org.apache.tools.ant.Target.performTasks(Target.java:413)
	at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
	at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
	at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
	at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
	at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:283)
	at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:541)
	at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:153)
Caused by: java.lang.ClassNotFoundException: javac1.8
	at org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoader.java:1365)
	at org.apache.tools.ant.AntClassLoader.findClass(AntClassLoader.java:1315)
	at org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:1068)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:259)
	at org.apache.tools.ant.util.ClasspathUtils.newInstance(ClasspathUtils.java:249)
	... 35 more
Comment 1 Jesse Glick 2012-06-01 19:14:18 UTC
Bug in Ant. Until the IDE bundles Ant 1.9.0, the workaround is to define build.compiler=javac1.7 in Tools > Options > Java > Ant > Properties. The IDE could perhaps do this workaround automatically.
Comment 2 Milos Kleint 2013-03-06 10:08:20 UTC
*** Bug 227089 has been marked as a duplicate of this bug. ***
Comment 3 Milos Kleint 2013-04-09 12:01:58 UTC
we bundle 1.9.0 ant in dev build. please try again and reopen if the problem still appears.
Comment 4 David Konecny 2013-07-24 03:15:27 UTC
*** Bug 223808 has been marked as a duplicate of this bug. ***
Comment 5 Azmeer 2014-04-17 04:16:52 UTC
I did a fresh install of NB8.0. Then cordova, git via Node. ant is 1.9.3 Everything is fine until I try to run sim-android target. It gives me Class not found: javac1.8.

I added build.compiler=javac1.7 as instructed and I can see it's been passed to ant.

I use jdk1.8.0_05 

ANT command line from NB output window:
===============================================
ant -f <path to>nbproject "-Dupdate.task.jar=C:\\Program Files\\NetBeans 8.0\\webcommon\\ant\\extra\\org-netbeans-modules-cordova-projectupdate.jar" -Dandroid.project.activity=HTML5Application -Dsite.root=www -Dstart.file=index.html -Dandroid.sdk.home=<path to android sdk> -Dandroid.target.device.arg=run "-Dcordova.version=3.4.1-0.1.0
" -Denv.DISPLAY=:0.0 "-Dios.certificate.name=iPhone Developer" -Dandroid.build.target=android-17 -Dconfig=android_1 -Dbuild.compiler=javac1.7 sim-android

Error message
==============
BUILD FAILED
D:\eclipse\sdk\tools\ant\build.xml:601: The following error occurred while executing this line:
D:\eclipse\sdk\tools\ant\build.xml:720: The following error occurred while executing this line:
D:\eclipse\sdk\tools\ant\build.xml:734: Class not found: javac1.8
Comment 6 Azmeer 2014-04-17 04:37:34 UTC
line 734 from build.xml:
fork="${need.javac.fork}">

Do I need to install JDK 1.7?
Comment 7 Martin Balin 2016-07-07 08:39:22 UTC
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue.

Thanks for your cooperation,
NetBeans IDE 8.2 Release Boss