Friday, February 23, 2007

java.io.IOException: CreateProcess: ... error=193

Most common cause for this error is caused my a missing extension. If you do not specify an extension for the called file (Ex: C:/cvs instead of C:/cvs.exe), assuming the executable will be called then you;re in trouble. Why ? Because often enough the called program creates a log file that has the same name with the called executable and Boom java.io.IOException: CreateProcess: ... error=193 !!!

So:
Rule 1: Always specify the extension, better safe than sorry.
Rule 2. If you break rule one and you get error193, check for files with the same name as the one you intend to call. (error 193 actually means that what you are trying to execute is not a valid Win32 process)

22 comments:

Raghavan alias Saravanan M said...

Hey,

That was an useful post for me when i was in need of it and thanks to google which listed urs as 3rd entry!

Yes you are right. But i faced a different issue with 'services.msc' eventhough it was having a proper extension and a valid win32 application.

The issue was it was just given as

new Runtime().exec("services.msc");

it should be executed in the other way around it seems. with respect to a command prompt if it is executed, things go fine. Again thanks to google ! It should be invoked as

new Runtime().exec("cmd.exe /C services.msc");

This works fine. Just thought of sharing the stuff so that it may help others who is in need of and indeed to you buddy!

Keep up the great work!

Cheers,
Raghavan alias Saravanan M.

Anonymous said...

The error code is delivered by the Windows OS and migrates up to the java application through the Java Native Interface. You can find the original meaning of the error on the Microsoft Support site at http://support.microsoft.com.

In my case, as an example, I got "CreateProcess error=1455". I found its meaning was "The paging file is too small fot this operation to complete." This fitted exactly my situation, in retrospect. It was listed at
support.microsoft.com/kb/186552/en-us

Hope it helped...

Laurent

Anonymous said...

Thanks guys, THIS was the key for me !

it should be executed in the other way around it seems. with respect to a command prompt if it is executed, things go fine. Again thanks to google ! It should be invoked as

new Runtime().exec("cmd.exe /C services.msc");

ankit said...

i have created two applet file Student1.java and Student2.java.

when i click on the butto on Student1 ,the second applet Student should be open.

i wrote the code:-


if(obj1==b)
{

Process P;
Runtime r=Runtime.getRuntime();

try
{
P=r.exec("Student.class");
}
catch(IOException e)
{ System.out.println("exception:" +e.getMessage());
e.printStackTrace();
}
}

it gives error=193
i have also used

P=r.exec("cmd.exe /Student.class");

but it's not working
plzzz help

both files are applet

Adrian Florea said...

Hi ankit,

Running java classes is a little bit more complicated because they are not real executable files. Try invoking the second applet with the usual java command. Check here for how to run java classes (the actual process you should invoke is java.exe with your applet as parameter): http://www.cs.usfca.edu/~parrt/course/601/lectures/java.tools.html

ankit said...

hi Adrian
you suggest- invoking the second applet with the usual java command. Check here for how to run java classes (the actual process you should invoke is java.exe with your applet as parameter):

can you explain it with an example

ankit said...

thanks adrian,finally i got it.

thank u very much for your suggestion.

ankit said...

how can i run an applet using web browser?

Adrian Florea said...

Running an Applet from a browser window.

You can achieve this by using the applet tag (it has several variations depending on where your applet class is stored compared to the html file that is using it, if the applet is packed in a jar file etc.)

The following link should provide enough information for you to start with.
http://java.sun.com/j2se/1.4.2/docs/guide/misc/applet.html

If the link is not enough, post some more details regarding your applet, where it is located, is it packed in a jar file, which classes is using, does it have to access the client file system etc. and I'll try to give you more datails on what you need to use.

ankit said...

how can i pass a variable from one applet to another.

i have an applet which has to input employee details id,name,address etc into textFields.
i have another applets for searching and updating data,according to name(combobox).

what i want is that,when i input details on first time of any person,name should be added into all searching and updating form into name(combobox)at the same time.

ankit said...

i got an exeption-exception:[Microsoft][ODBC SQL server Driver] COUNT field incorrect or syntax error

how to deal with it

ankit said...

i have solved the problem myself exception:[Microsoft][ODBC SQL server Driver] COUNT field incorrect or syntax error
by changing the java.util.Date format to java.sql.Date format, program compiles and run fine but when i fill the data in form and send to database, i am getting the exception:[Microsoft][ODBC SQL server Driver]Optional featute not implement.

Anonymous said...

Thanks Raghavan, that was useful!

Anonymous said...

Very useful post about for tracking down my error trying to build a front-end application trying to run flex compiler (which was listed as mxmlc and not mxmlc.exe !

Thanks so much!!!

Anonymous said...

Thanks guys..!!

"CMD /C" too helped me..

Anonymous said...

I faced the same issue because I had left out .bat. This is very useful. Thanks!

- Pavan

Aberrant Aeon said...

Woot! Rule number one saved me! The exec method was calling "jar" and in my bin folder there was a text file called "jar", so jar.exe was never executed, it tried to run the "jar" text file.

Madiha said...

The extension rule fixed my error. Thanks!

Yogesh said...

Well that was a nice post.

But I have a different requirement

I want to execute certain commands by changing my directory to D drive.

How can I do that?

Please mail me to yogesh249 at gmail dot com

Anonymous said...

Hi, one question, the sqlldr by oracle run in linux ???

Thanks.

Anonymous said...

i want to exceute batch file,so that for hat i have given the path of the batch File.

Process p = Runtime.getRuntime().exec("C:\\IBM\\WebSphere\\wp_profile\\PortalServer\\bin\\xmlaccess.bat");

But still m getting same issue..Please help me out.

Abhishek Mahapatra said...

Yeah Yogesh...
if u want 2 change D drive..

System.out.println("Current working directory:");
System.out.println(System.getProperty("user.dir"));
System.out.println(new File(".").getAbsolutePath());
System.out.println("Changing working directory...");
System.setProperty("user.dir", "D:\\IBM");
System.out.println("Current working directory:");