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 126709 - Duplicate javac file in C:\Program Files\Java\jdk1.6.0_01\bin folder
Summary: Duplicate javac file in C:\Program Files\Java\jdk1.6.0_01\bin folder
Status: RESOLVED INVALID
Alias: None
Product: ide
Classification: Unclassified
Component: Code (show other bugs)
Version: 6.x
Hardware: All Windows XP
: P4 blocker (vote)
Assignee: issues@ide
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-02-05 13:33 UTC by baskaraninfo
Modified: 2008-02-07 09:42 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description baskaraninfo 2008-02-05 13:33:51 UTC
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.
Comment 1 Jiri Prox 2008-02-07 09:42:22 UTC
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.