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.
When "C:\Program Files\Java\jdk1.6.0_01\bin" folder contains javac [file type is "Application"] and another file in the same name, but its type is File or something other than "Application". If it is the case, then whenever we execute command in the DOS-prompt, its working fine. But, when we try to run the command through netbeans, its throughing error such as, java.io.IOException: Cannot run program ""C:\Program": CreateProcess error=193, %1 is not a valid Win32 application at java.lang.ProcessBuilder.start(ProcessBuilder.java:459) at java.lang.Runtime.exec(Runtime.java:593) at java.lang.Runtime.exec(Runtime.java:431) at java.lang.Runtime.exec(Runtime.java:328) The below code may be useful to produce the issue : // This method is used to compile the java files inside the given folder // folderPath - is the folder which contains some java files private void compileFolder(String folderPath) { try { File file = new File(folderPath); String javaHome = System.getProperty("java.home"); javaHome = javaHome.replaceFirst("jre", "bin") + Constants.getFileSeparator(); javaHome = "\"" + javaHome + "javac" + "\""; StringBuffer buffer = new StringBuffer(); buffer.append(javaHome); if (file.isDirectory()) { File[] fileList = file.listFiles(FileUtil.getFileFilter(new String[]{FileExtConstant.JAVA})); String temp = ""; Runtime runtime = Runtime.getRuntime(); for (File fileName : fileList) { temp = fileName.toString(); buffer.append(" \"" + temp + "\""); buffer.append(" -d \"" + temp.substring(0, temp.indexOf(Constants.getJavaPath())) + Constants.getClassPath() + "\""); runtime.exec(buffer.toString()); } } } catch (Exception ex) { ex.printStackTrace(); } } Explanation : When there are two javac files and we try to run this, it produces the above error.
Sorry, but this is not problem of IDE, probably you're calling runtime.exec with wrong parameter, try debug the program. If there are two javac files they will differ by the extension, you can use it to differentiate between the files.