CreateProcess error=87, The parameter is incorrect

0

 I created a report using ireports and called it from my java application only to get this error message:

 
run:
C:\\Documents and Settings\\Administrator\\.netbeans\\6.8\\var\\cache\\executor-snippets\\run.xml:49: java.io.IOException: Cannot run program "C:\\Program Files\\Java\\jdk1.6.0_17\\bin\\java.exe" (in directory "D:\\skool\\School"): CreateProcess error=87, The parameter is incorrect
        at org.apache.tools.ant.taskdefs.Java.fork(Java.java:791)
        at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:211)
        at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:132)
        at org.apache.tools.ant.taskdefs.Java.execute(Java.java:105)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        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:357)
        at org.apache.tools.ant.Target.performTasks(Target.java:385)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
        at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
        at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:278)
        at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:498)
        at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:151)
Caused by: java.io.IOException: Cannot run program "C:\\Program Files\\Java\\jdk1.6.0_17\\bin\\java.exe" (in directory "D:\\skool\\School"): CreateProcess error=87, The parameter is incorrect
        at java.lang.ProcessBuilder.start(ProcessBuilder.java:459)
        at java.lang.Runtime.exec(Runtime.java:593)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.tools.ant.taskdefs.Execute$Java13CommandLauncher.exec(Execute.java:832)
        at org.apache.tools.ant.taskdefs.Execute.launch(Execute.java:447)
        at org.apache.tools.ant.taskdefs.Execute.execute(Execute.java:461)
        at org.apache.tools.ant.taskdefs.Java.fork(Java.java:784)
        ... 19 more
Caused by: java.io.IOException: CreateProcess error=87, The parameter is incorrect
        at java.lang.ProcessImpl.create(Native Method)
        at java.lang.ProcessImpl.<init>(ProcessImpl.java:81)
        at java.lang.ProcessImpl.start(ProcessImpl.java:30)
        at java.lang.ProcessBuilder.start(ProcessBuilder.java:452)
        ... 28 more
--- Nested Exception ---
java.io.IOException: Cannot run program "C:\\Program Files\\Java\\jdk1.6.0_17\\bin\\java.exe" (in directory "D:\\skool\\School"): CreateProcess error=87, The parameter is incorrect
        at java.lang.ProcessBuilder.start(ProcessBuilder.java:459)
        at java.lang.Runtime.exec(Runtime.java:593)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.tools.ant.taskdefs.Execute$Java13CommandLauncher.exec(Execute.java:832)
        at org.apache.tools.ant.taskdefs.Execute.launch(Execute.java:447)
        at org.apache.tools.ant.taskdefs.Execute.execute(Execute.java:461)
        at org.apache.tools.ant.taskdefs.Java.fork(Java.java:784)
        at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:211)
        at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:132)
        at org.apache.tools.ant.taskdefs.Java.execute(Java.java:105)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        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:357)
        at org.apache.tools.ant.Target.performTasks(Target.java:385)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
        at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
        at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:278)
        at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:498)
        at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:151)
Caused by: java.io.IOException: CreateProcess error=87, The parameter is incorrect
        at java.lang.ProcessImpl.create(Native Method)
        at java.lang.ProcessImpl.<init>(ProcessImpl.java:81)
        at java.lang.ProcessImpl.start(ProcessImpl.java:30)
        at java.lang.ProcessBuilder.start(ProcessBuilder.java:452)
        ... 28 more
Java Result: -1
 
 
Please can someone help on how I can display my report my Java application.
Thank you.
 
 
Code:
package School;
 
 
 
/**
 
 *
 
 * @author Emmanuel
 
 */
 
import net.sf.jasperreports.engine.*;
 
import net.sf.jasperreports.engine.export.*;
 
import java.util.*;
 
 
 
public class JasperTest {
 
 
 
    public static void main(String[] args) {
 
        String fileName = "report1.jasper";
 
        String outFileName = "test.pdf";
 
        HashMap hm = new HashMap();
 
        try {
 
            // Fill the report using an empty data source
 
            JasperPrint print = JasperFillManager.fillReport(fileName, hm, new JREmptyDataSource());
 
 
 
            // Create a PDF exporter
 
            JRExporter exporter = new JRPdfExporter();
 
 
 
            // Configure the exporter (set output file name and print object)
 
            exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, outFileName);
 
            exporter.setParameter(JRExporterParameter.JASPER_PRINT, print);
 
 
 
            // Export the PDF file
 
            exporter.exportReport();
 
 
 
        } catch (JRException e) {
 
            e.printStackTrace();
 
            System.exit(1);
 
        } catch (Exception e) {
 
            e.printStackTrace();
 
            System.exit(1);
 
        }
 
    }
 
}
 
</td></tr></tbody></table>
mbithi's picture
1
Joined: Aug 12 2010 - 11:05pm
Last seen: 3 years 11 months ago

1 Answer:

0

Hi,

As you can probably find out on Google, this issue is not related to JasperReports, but to the limited length of CLASSPATH values.

You probably need to shorten your application classpath.

http://stackoverflow.com/questions/2893970/fail-to-launch-application-createprocess-error87-cant-use-shorten-classpath

Julien

jvivenot's picture
Joined: Aug 2 2010 - 6:23am
Last seen: 3 years 12 months ago
Feedback