views:

29

answers:

2

Hi all, I've delopped some Scala code to control the lifecycle of MySQL server. The code runs fine on Windows XP, but fails under Windows 2008 R2 standard with the following exception:

Exception in thread "main" java.io.IOException: Cannot run program "mysql" (in directory ".\bin"): CreateProcess error=2, The system cannot find the file specified
        at java.lang.ProcessBuilder.start(ProcessBuilder.java:460)
        at com.quantel.dbcontroller.ProcessExecutor$.run(dbcontroller.scala:63)
        at com.quantel.dbcontroller.MySQL$User.execSQL(dbcontroller.scala:90)
        at com.quantel.dbcontroller.MySQL.isRunning(dbcontroller.scala:172)
        at com.quantel.dbcontroller.MySQL.start(dbcontroller.scala:126)
        at com.quantel.dbcontroller.Launch$.main(dbcontroller.scala:195)
        at com.quantel.dbcontroller.Launch.main(dbcontroller.scala)
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
        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:453)
        ... 6 more

I am a bit baffled as to why this works fine on XP but not on Windows 2008 R2. Has anyone experience something similar?

Thanks in advance.

A: 

Doesn't look like anything specific to Scala, There's something else changed when you upgraded windows (I'm assuming this was an upgrade)

Try double-checking that your system path is okay, that you're launching the program from the correct location, etc.

Kevin Wright
A: 

This was my mistake. I had forgotten to prefix the command to execute with cmd /c. Strangely, Windows XP does not complain about the omission of cmd /c while Windows 2008 does.

Guillaume