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.
Created attachment 109887 [details] Default build.xml Product Version: NetBeans IDE 7.0.1 (Build 201107282000) Java: 1.6.0_26; Java HotSpot(TM) 64-Bit Server VM 20.1-b02 System: Windows 7 version 6.1 running on amd64; Cp1252; en_US (nb) Userdir: C:\Users\sasbeb\.netbeans\7.0 The default build-impl.xml created when you create a Java Project with existing sources has a line: <property name="javac.fork" value="${jdkBug6558476}"/> This causes javac to fail within NetBeans' ant invocation. Changing to: <property name="javac.fork" value="false"/> Seems to be at least one workaround.
Created attachment 109888 [details] build-impl.xml Adding other project related files
Created attachment 109889 [details] project.properties Let me know if I left out a file
After I get the project to compile, it will not run or debug, failing at line 451 in the attached build-impl.xml
Product Version: NetBeans IDE 7.0.1 (Build 201107282000) Java: 1.7.0; Java HotSpot(TM) 64-Bit Server VM 21.0-b17 System: Windows 7 version 6.1 running on amd64; Cp1252; en_US (nb) Userdir: C:\Users\sasbeb\.netbeans\7.0 Re-installing NetBeans 7.0.1 and using JDK 1.7, and moving NetBeansProjects to c:\ ant gives me this: "C:\java_x64\jdk1.7.0\jre\bin\java.exe" (in directory "C:\NetBeansProjects\jmptojava-9.3"): CreateProcess error=206, The filename or extension is too long When I try to debug. There are no java, javac, javaws files in the PATH and CLASSPATH, JAVA_HOME and ANT_HOME are not set as environment variables.
This problem doesn't seem to exist in Linux. Product Version: NetBeans IDE 7.0.1 (Build 201107282000) Java: 1.6.0_26; Java HotSpot(TM) 64-Bit Server VM 20.1-b02 System: Linux version 2.6.38-7.dmz.2-liquorix-amd64 running on amd64; UTF-8; en_US (nb) Userdir: /home/sasbeb/.netbeans/7.0
Unfortunately the fork=true is needed due to fact that Windows is not able to delete opened file. This causes problems to annotation processors. Windows for some reason cannot create process for javac: "C:\java_x64\jdk1.7.0\jre\bin\java.exe" (in directory "C:\NetBeansProjects\jmptojava-9.3"): CreateProcess error=206, The filename or extension is too long You can workaround the problem by adding javac.fork=false to project.properties but you will have problems with annotation processors if you are using them. Is far as I remember NTFS has limitation 255 chars for path, but C:\java_x64\jdk1.7.0\jre\bin\java.exe seems much shorter. Can you attach ant debug output? It's seems as somehow broken JVM installation. The ant itself does not seem to be running in JDK 1.7 as the <matches pattern="1\.[56]" string="${java.specification.version}"/> is true.
Created attachment 109929 [details] ant debug output
I figured it was the command line in Windows. From the debug output (attached) it looks like it's possibly the -classpath option. Is there a way to specify the directory for jars (instead of individual jar files) in ant. That way NB ant projects can be more robust across platforms.
would something like -extdirs work?
No. Javac has argfiles which handle this problem. Ant should use them by default. But there were not used according to the attached debug.
I have re-installed NB (twice) without importing settings and have re-created the project "as is". This is the output I have. Is there any other setting I can try? (attaching the current build-impl.xml)
Created attachment 109934 [details] current build-impl.xml
I've looked once more on the debug. It does not crash in javac but java. The javac.fork has no effect on it, first it's false (you are running on JDK 7.0) second it affects only javac behavior.
Do you have any suggestions? This forces me to use "the other IDE" for code/compile/debug on Windows.
Well I am not Windows user, so it will need to search how to workaround it. I will then let you know.
I haven't been a Windows user in quite a while, either ;) I just so happen to be working on a Windows c++ client that uses JNI to call into Java.
Unfortunately unlike javac the java does not support argsfile. But you can try to pass the classpath as an environment variable. Can you try it if it works on Windows? If tried it on UNIX where it works fine, I have no Windows. To do it you need to do following: 1st) Turn off the compile on save (to be sure that the overriden tasks are called). It's in the project customizer/Compiling/Compile On Save. 2nd) Add the following macrodefs into your build.xml file (directly in the project folder). Insert it into project element just before </project>. <target name="-profile-init-macrodef-profile"> <macrodef name="resolve"> <attribute name="name"/> <attribute name="value"/> <sequential> <property name="@{name}" value="${env.@{value}}"/> </sequential> </macrodef> <macrodef name="profile"> <attribute default="${main.class}" name="classname"/> <element name="customize" optional="true"/> <sequential> <property environment="env"/> <resolve name="profiler.current.path" value="${profiler.info.pathvar}"/> <java classname="@{classname}" dir="${profiler.info.dir}" fork="true" jvm="${profiler.info.jvm}"> <jvmarg value="${profiler.info.jvmargs.agent}"/> <jvmarg line="${profiler.info.jvmargs}"/> <env key="${profiler.info.pathvar}" path="${profiler.info.agentpath}:${profiler.current.path}"/> <arg line="${application.args}"/> <syspropertyset> <propertyref prefix="run-sys-prop."/> <mapper from="run-sys-prop.*" to="*" type="glob"/> </syspropertyset> <env key="CLASSPATH" path="@{classpath}"/> <customize/> </java> </sequential> </macrodef> </target> <target depends="-init-debug-args" name="-init-macrodef-debug"> <macrodef name="debug" uri="http://www.netbeans.org/ns/j2se-project/3"> <attribute default="${main.class}" name="classname"/> <attribute default="${debug.classpath}" name="classpath"/> <element name="customize" optional="true"/> <sequential> <java classname="@{classname}" dir="${work.dir}" fork="true"> <jvmarg line="${endorsed.classpath.cmd.line.arg}"/> <jvmarg line="${debug-args-line}"/> <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/> <jvmarg value="-Dfile.encoding=${runtime.encoding}"/> <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/> <jvmarg line="${run.jvmargs}"/> <syspropertyset> <propertyref prefix="run-sys-prop."/> <mapper from="run-sys-prop.*" to="*" type="glob"/> </syspropertyset> <env key="CLASSPATH" path="@{classpath}"/> <customize/> </java> </sequential> </macrodef> </target> <target name="-init-macrodef-java"> <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1"> <attribute default="${main.class}" name="classname"/> <attribute default="${run.classpath}" name="classpath"/> <element name="customize" optional="true"/> <sequential> <java classname="@{classname}" dir="${work.dir}" fork="true"> <jvmarg line="${endorsed.classpath.cmd.line.arg}"/> <jvmarg value="-Dfile.encoding=${runtime.encoding}"/> <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/> <jvmarg line="${run.jvmargs}"/> <syspropertyset> <propertyref prefix="run-sys-prop."/> <mapper from="run-sys-prop.*" to="*" type="glob"/> </syspropertyset> <env key="CLASSPATH" path="@{classpath}"/> <customize/> </java> </sequential> </macrodef> </target> It looks complicated but it's only small modification of macrodefs from build-impl.xml which are now changed. The change is that instead of passing classpath as a -classpath cmd argument we pass it as an environment variable.
Nice Tomas, The workaround works for compile,run/debug. Can this be incorporated into NetBeans Ant Project "proper"? I have 356 jars in my project. (and you know how long jar file names can be). So it can quickly become longer than 255 characters (and not work on Windows). Thanks for you help.
Thanks Bryan for the testing. I am now on vacation, when I will be back I will either try to find some nicer way or make this a default.
Enjoy your vacation;) Now to see if I can leave Visual Studio by figuring out how to compile my cpp files with NetBeans and the VS compiler. Thanks for your help.
Hi, is there any progress on this? I'm just getting the same problem. The fact that this suddenly pops up as your project grows and while you're actually wanting to do just completely different things is really ... not supporting happiness in the developer. I have just run the ant command manually with the verbose option on to identify and understand the problem, and have reconstructed the command line Netbeans is submitting to windows. It is exactly 32933 characters long, so I guess there is a limitation to 2^15 characters in a command line in Windows. I'm using around 140 libaries (.jar files) in that project, and currently each of them is added to the command line as an absolute path individually although they're all in the same directory. Another problem is that Netbeans is making it so very, very hard to diagnose what's wrong at all. You really need expert knowledge in several fields to get to the root of the problem. Otherwise you're stuck with just this brief error message that can drive you insane: "Error running C:\Programme\Java\jdk1.6.0_35\bin\javac compiler BUILD FAILED" I haven't found any way to make this more detailed in Netbeans itself. -- If anybody could recommend a workaround, I'd be really grateful. -- I emphasize that according to my understanding of the problem you don't need Windows expertise to understand the challenge and test your solution: The compiler command line must not be longer than 2^15 characters. You may as well code and test this in Linux. Thank you.
You can use Long path Tool for such issues, it works good.
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
I just downloaded Netbeans 8.2RC today (9/16/2016) and tried this on Windows 10. If I do "Test file" it runs all the tests in my tests fine. If I do a "Debug test file" it runs all the tests in the class just fine. If I do a "run focused test method" it runs fine. If I do a "debug focused test method" I get the same error as was reported in this bug. I am sure that this is because Netbeans is passing classpath on the command line instead of using a -D option. It must have been fixed for the other cases, but not for "debug focused test method". Notice in the stack trace below the key problem is: The filename or extension is too long Here is the stack trace. Testcase: com.pelco.vms.webService.e2e.auth.AuthorizationE2eTest:null: Caused an ERROR Forked Java VM exited abnormally. Please note the time in the report does not reflect the time until the VM exit. junit.framework.AssertionFailedError: Forked Java VM exited abnormally. Please note the time in the report does not reflect the time until the VM exit. at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:153) C:\Users\darbie\AppData\Local\NetBeans\Cache\8.2rc\executor-snippets\junit-debug.xml:180: The following error occurred while executing this line: C:\Users\darbie\AppData\Local\NetBeans\Cache\8.2rc\executor-snippets\junit-debug.xml:106: Process fork failed. at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.executeAsForked(JUnitTask.java:1259) at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.execute(JUnitTask.java:1024) at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.executeOrQueue(JUnitTask.java:2105) at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.execute(JUnitTask.java:832) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293) at sun.reflect.GeneratedMethodAccessor108.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) 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:293) at sun.reflect.GeneratedMethodAccessor108.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) 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:396) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293) at sun.reflect.GeneratedMethodAccessor108.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) 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:435) at org.apache.tools.ant.Target.performTasks(Target.java:456) at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1405) at org.apache.tools.ant.Project.executeTarget(Project.java:1376) at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41) at org.apache.tools.ant.Project.executeTargets(Project.java:1260) at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:286) at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:555) at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:153) Caused by: java.io.IOException: Cannot run program "C:\apps\Java\jdk1.8.0_77\bin\java.exe" (in directory "D:\workspace\trunk\vxfoundry\vmscore"): CreateProcess error=206, The filename or extension is too long at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048) at java.lang.Runtime.exec(Runtime.java:620) at org.apache.tools.ant.taskdefs.launcher.Java13CommandLauncher.exec(Java13CommandLauncher.java:58) at org.apache.tools.ant.taskdefs.Execute.launch(Execute.java:426) at org.apache.tools.ant.taskdefs.Execute.execute(Execute.java:440) at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.executeAsForked(JUnitTask.java:1257) ... 32 more Caused by: java.io.IOException: CreateProcess error=206, The filename or extension is too long at java.lang.ProcessImpl.create(Native Method) at java.lang.ProcessImpl.<init>(ProcessImpl.java:386) at java.lang.ProcessImpl.start(ProcessImpl.java:137) at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029) ... 37 more BUILD FAILED (total time: 1 second)
In my previous comment I said this: I am sure that this is because Netbeans is passing classpath on the command line instead of using a -D option. It must have been fixed for the other cases, but not for "debug focused test method". What I really should have said was this: I believe this is because Netbeans is creating a -classpath command line for the ant junit task that is too long for windows. If it were to set the CLASSPATH environment variable instead then I believe the problem would be fixed. I saw a similar issue with gradle and was able to fix the problem in our build.gradle by switching to the environment variable instead of the command line argument. I believe this would be a fairly easy fix for someone who is good with ant. I am really hoping someone will pick up this bug and fix it. I am a bit discouraged that this was originally submitted in 2011 and is still an issue.
Please try using long path tool
Try to make ANT build to use a single jar - 'xmlbeans.**.jar' for xmltask execution (classpathref="build.xmlbeans.lib.path). This should fix the error ""C:\java_x64\jdk1.7.0\jre\bin\java.exe" (in directory "C:\NetBeansProjects\jmptojava-9.3"): CreateProcess error=206, The filename or extension is too long "
Hi! I also encounter the same problem but only Long path tool worked for me . Try using it too. I hope it helps.