Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

java.io.IOException: Cannot run program "mysql":CreateProcess error=2, The system cannot find the fi

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How are you my friends?

Something is going wrong with my program for database recovery, this error hides my happiness:
java.io.IOException: Cannot run program "mysql":CreateProcess error=2, The system cannot find the file specified

file to be recovered is located in D:/Backup/backup.sql when I browse and open the file from this path then error appears when I I click recovery button. Please help me to solve this problem.
below is my code with JFileChooser for browsing file location.

 
Master Rancher
Posts: 4665
49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your exec call is attempting to launch mysql.
It will look for that in your PATH.
Is it registered there?

If not you will need to use the full path to the executable...that's the file it can't find, not the backup sql file.
 
Nasoro Salum
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Dave Tolls wrote:Your exec call is attempting to launch mysql.
It will look for that in your PATH.
Is it registered there?

If not you will need to use the full path to the executable...that's the file it can't find, not the backup sql file.



I would like to know how can I add that full path to the executable, because I use mysql and I added something as it can be seen now but still that error occurs:

 
Dave Tolls
Master Rancher
Posts: 4665
49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That execute call is trying to make a call to the underlying OS (Windows in your case, at a guess).
It's a little like typing a command on the command line (though read through this article, as there are common traps people fall into when using it).

Anyway, that aside, what is it exactly you are trying to do?

It looks like you are trying to launch mysql to create a database froma backup?
Is that correct?
 
Nasoro Salum
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Dave Tolls wrote:That execute call is trying to make a call to the underlying OS (Windows in your case, at a guess).
It's a little like typing a command on the command line (though read through this article, as there are common traps people fall into when using it).

Anyway, that aside, what is it exactly you are trying to do?

It looks like you are trying to launch mysql to create a database from a backup?
Is that correct?



Yes, I want to create a database from a backup(backup recovery).
 
Dave Tolls
Master Rancher
Posts: 4665
49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So what is the command to do that from the command line?

That is what you need to recreate in your exec call.
 
Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic