aspose file tools*
The moose likes Java in General and the fly likes create process error = 2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "create process error = 2" Watch "create process error = 2" New topic
Author

create process error = 2

Lisha Hercules
Greenhorn

Joined: Feb 17, 2012
Posts: 6
Hi,

I'm trying to print a password using a printer that is already configured to my system.

But when I click on print, all the classes are working fine, except the PrintUtil class , which gives me the java.io.Exception.

I've pasted a copy of the trace below.

Would be grateful to anyone who could find a solution. If any more details are required, please ask as i don't know where to look to figure out the error.

LOGS

42316 [28108402@qtp-16651101-3] DEBUG app.tracelog - LoginPinMailerExtractService:exService Entered
42316 [28108402@qtp-16651101-3] DEBUG app.tracelog - LoginPinMailerExtractService:exService userid : administrator
42316 [28108402@qtp-16651101-3] DEBUG app.tracelog - LoginPinMailerExtractService:exService strbatchno before customer list retrieval:
42331 [28108402@qtp-16651101-3] DEBUG app.pintracelog - PinMailerProcessLogin:extractProcess() Extract Process Started :
42456 [28108402@qtp-16651101-3] DEBUG app.pintracelog - PinMailerProcessLogin:extractProcess() Extract Process querystring : SELECT AUL.USER_ID, AUL.USER_NAME, TRANS_REF_NO, USER_EMAIL FROM APP_USER_LOGIN_PWD_REQUEST AUL,IHB_USER_PROFILE AUP WHERE AUL.USER_ID=AUP.USER_ID AND AUL.USER_ID IN ('testbankuser124') AND STATUS = 'C'
42456 [28108402@qtp-16651101-3] DEBUG app.pintracelog - PinMailerProcessLogin:extractProcess() Extract Process querystring : SELECT AUL.USER_ID, AUL.USER_NAME, TRANS_REF_NO, USER_EMAIL FROM APP_USER_LOGIN_PWD_REQUEST AUL,IHB_USER_PROFILE AUP WHERE AUL.USER_ID=AUP.USER_ID AND AUL.USER_ID IN ('testbankuser124') AND STATUS = 'C'
42487 [28108402@qtp-16651101-3] DEBUG app.pintracelog - PinMailerProcessLogin:extractProcess() Extract Process userid : testbankuser124
42487 [28108402@qtp-16651101-3] DEBUG app.pintracelog - PinMailerProcessLogin:extractProcess() Extract Process username : testbankuser
42487 [28108402@qtp-16651101-3] DEBUG app.pintracelog - PinMailerProcessLogin:extractProcess() Extract Process tranrefno : 5554
42487 [28108402@qtp-16651101-3] DEBUG app.pintracelog - PinMailerProcessLogin:extractProcess() Extract Process useremail : testbankuser124
42487 [28108402@qtp-16651101-3] DEBUG app.pintracelog - PinMailerProcessLogin:getCustomerDetails CustomerId:testbankuser124
42518 [28108402@qtp-16651101-3] INFO app.pintracelog - PinMailerControllerLogin:generatePinMailer Pin File Name:/workspace/DLB/retail/admin/data/pinmailerlogin/Pinmailer.ps
42518 [28108402@qtp-16651101-3] DEBUG app.pintracelog - PinMailer:writePinMailer Details Map pad :Key Array:[pinmessage, userid, username, tranrefno, pinnumber, pinbatchno, useremail, address1, address2, address3, address4, address5],Values:[Pin : Login Password, testbankuser124, testbankuser, 5554, P1*8WB1#, 22852295, testbankuser124, DEPOSIT, , , , ]
42534 [28108402@qtp-16651101-3] DEBUG app.tracelog - PrintUtil:printUtil -2 PrinterName : TVS MSP 245 Star
42534 [28108402@qtp-16651101-3] DEBUG app.tracelog - PrintUtil:printUtil -2 File Path : D:/workspace/DLB/retail/admin/data/pinmailerlogin/Pinmailer.ps
42534 [28108402@qtp-16651101-3] DEBUG app.tracelog - PrintUtil:printUtil -2 Exception : java.io.IOException: Cannot run program "printtest": CreateProcess error=2, The system cannot find the file specified
42534 [28108402@qtp-16651101-3] INFO app.pintracelog - PinMailerControllerLogin:generatePinMailer statusFlag : false



Wendy Gibbons
Bartender

Joined: Oct 21, 2008
Posts: 1107

what is the exception telling you (it appears to be being very helpful) have you looked for the missing item?
Lisha Hercules
Greenhorn

Joined: Feb 17, 2012
Posts: 6
yes. i've checked for the file it says is missing. Pinmailer.ps

It's present in the specified directory. It contains data as well.
Lisha Hercules
Greenhorn

Joined: Feb 17, 2012
Posts: 6
Hi,

I've still not found a solution but I think I've found where its getting stuck.

Inside the PrintUtil class I'm passing a command string to the exec method.

The code looks like this.





The command when printed on the trace looks like this.

printtest TVS MSP 245 Star@D:/workspace/DLB/retail/admin/data/pinmailerlogin/Pinmailer.ps






Is it the right way to pass a command to exec?
Wendy Gibbons
Bartender

Joined: Oct 21, 2008
Posts: 1107

sorry no idea, I am ducking out now.

only 1 thing left to try do you use File.separator to make the string?
Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3689
    
  16
Does printtest exist ? can you run this command from a command propmpt ?


Joanne
Lisha Hercules
Greenhorn

Joined: Feb 17, 2012
Posts: 6
No it doesn't run on the command prompt. Says invalid command.

I tried with print as well.

print /d:TVSMSP245Star D:\pinmailer.ps

(I've created a file called pinmailer.ps under the d drive for testing)

but still it doesn't seem to work.

It says unable to initialize device TVSMSP245Star. I've checked the name of the printer in properties. It's correct so far.

I don't get why it is not able to initialize. Also, mine is a USB printer on port USB001. Is there a separate syntax for that?
Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3689
    
  16
Well if it doesn't work from the command prompt, then it's not a Java problem.
Can you print to this printer using another program such as notepad ?
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39436
    
  28
And welcome to the Ranch
Lisha Hercules
Greenhorn

Joined: Feb 17, 2012
Posts: 6
Yes of course.. It's working well with all other programs, where the print dialog box opens, and I have to click Print.

It's just not budging if I try to do it from the command prompt.






Thank you, Sheriff... This is the first time I'm registering on something like this, and it feels good to know people out there are taking time off to help me out. I hope I am also able to contribute the little knowledge that I have, to others out there like me.
Lisha Hercules
Greenhorn

Joined: Feb 17, 2012
Posts: 6
I resolved it myself. Thank you all for trying to help me.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: create process error = 2