Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9251205
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T10:38:18+00:00 2026-06-18T10:38:18+00:00

I am getting the following error message when I try to run the following

  • 0

I am getting the following error message when I try to run the following build.xml file to work with mysql from my java application in eclipse:

BUILD FAILED
d:\mypath\workspace\appname\database\build.xml:14: Execute failed: java.io.IOException: Cannot run program “mysql”: CreateProcess error=2, The system cannot find the file specified

Here is the code for build.xml:

<?xml version="1.0" encoding="UTF-8"?>

<project name="publisher" default="all" basedir=".">
  <property name="mysql.params" value="-u publisher -ppublisher -D publisher" />
  <target name="all" depends="cleandb, createdb, insertdb"></target>

  <target name="cleandb">
     <exec executable="mysql" input="cleandb.sql">
        <arg line="${mysql.params}" />
     </exec>
  </target>

  <target name="createdb">
     <exec executable="mysql" input="createdb.sql">
        <arg line="${mysql.params}" />
     </exec>
  </target>

  <target name="insertdb">
     <exec executable="mysql" input="insertdb.sql">
        <arg line="${mysql.params}" />
     </exec>
  </target>
</project>

From eclipse, I am running the file as “Ant Build…” and am calling createdb.sql first. Thus, the line that is throwing is the first line that is being asked to execute, which is:

The problem seems to be that the script is not able to locate mysql. From the windows command line, I am able to call the instance of the database using the following path:
d:\mypath\MySQL\MySQL Server\bin\mysqld

I think the xml file needs to specify the path of the mysql installation, but I am not sure how to do that while also passing the parameters required in the code above. This is my first time working with Ant and with mysql, so the syntax is new to me.

Can anyone show me how to fix the code above so that it can find my database?

EDIT:


I followed whiskeyspider’s suggestion and edited my code to become the following:

-- I had a bunch of code here that I am now omitting for brevity because  
-- there is a newer, revised version of the code in the second edit below.

It may help some readers to know that I am trying to use code from this tutorial. The difference is that I am using version 5.6 of mysql and Version: Juno Service Release 1
Build id: 20120920-0800 of Eclipse. The tutorial uses older versions of both applications, which is what is causing the confusion.

SECOND EDIT:


I changed the build.xml file again to implement whiskeyspider’s second round of corrections. The script now accesses the mysql database, but there is another message about which I have a question, below.

Here is the new build.xml code, which runs correctly now:

<?xml version="1.0" encoding="UTF-8"?>

<project name="publisher" default="all" basedir=".">
  <property name="mysql.params" value="-u publisher -ppublisher -D publisher" />
  <property name="mysql.exec.path" value="d:\\mypath\\MySQL\\bin\\"/>
  <target name="all" depends="cleandb, createdb, insertdb"></target>

  <target name="cleandb">
     <exec executable="${mysql.exec.path}/mysqld" input="cleandb.sql">
        <arg line="${mysql.params}" />
     </exec>
  </target>

  <target name="createdb">
     <exec executable="${mysql.exec.path}/mysqld" input="createdb.sql">
        <arg line="${mysql.params}" />
     </exec>
  </target>

  <target name="insertdb">
     <exec executable="${mysql.exec.path}/mysqld" input="insertdb.sql">
        <arg line="${mysql.params}" />
     </exec>
  </target>
</project>

Here is the log reported in the eclipse console when build.xml is run:

Buildfile: d:\mypath\workspace\publisher\database\build.xml
createdb:
     [exec] Warning: Using a password on the command line interface can be insecure.
insertdb:
     [exec] Warning: Using a password on the command line interface can be insecure.
BUILD SUCCESSFUL
Total time: 1 second  

Can anyone tell me how I can address this warning by improving security when I need to use passwords to get into databases from ant code run using eclipse? How, specifically, can I change my code so that the same tasks are performed without the security risk?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T10:38:19+00:00Added an answer on June 18, 2026 at 10:38 am

    Create a property with the path to the executable:

    <property name="mysql.exec.path" value="C:/path/to/it" />
    

    You can make it portable by first loading a local properties file that may override it, for example:

    <property file="${user.home}/local.properties" />  // can override mysql.exec.path property, if necessary
    <property name="mysql.exec.path" value="C:/path/to/it" />  // if not, use the default
    

    Then reference it like so:

    <exec executable="${mysql.exec.path}/mysql" input="cleandb.sql">
      <arg line="${mysql.params}" />
    </exec>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am getting the following error message when I try to run the following
I am getting the following error, when I try to run my application: uninitialized
I'm getting the error message when running the following code from a C# console
I am getting the following error message when compiling or attempting to run my
I am getting the following error message when I try to compare my project
I am getting a warning message when I try to run my asp.net application
I am getting the following error message when I try to HTTPS a website:
I am getting JVM error 104 error message, when I try to run my
I am getting following error message: java.lang.IllegalStateException: Neither BindingResult nor plain target object for
I am getting the following error message from a bulk load in sql server

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.