I want to create a data file(.txt) with the data in a mysql table. (of course i did that)

try {
					// Create the statement
					

					 //Export the data
				String filename = "test.xls";
				String tablename = "test";
	c.getData("SELECT * INTO OUTFILE '"+ filename + "' FROM " + tablename);
				System.out.println(filename);
				} catch (Exception e) {}

This create the test.xls file in the folder that the java class in.

I want to make that file created in a specific folder rather than the folder that the java class is in.

**getdata() method is OK.

How can I do that?

Make the file name the complete path, startiung with c: or whatever.

ps: Don't forget that \ is the escape character in Java Strings - so to put a \ in the file path you need to code \\

Edited 7 Years Ago by JamesCherrill: ps

pps:
Rather than absolute paths that may not work from one machine to another, you can also get the paths to useful folders in a system-independent way with calls like
System.getProperty("user.home")

This question has already been answered. Start a new discussion instead.