At run time, file operations are performed relative to the working directory when absolute paths are not specified so that means a FileOutputStream("myfile.txt") will create the file in the current working directory whatever that is.
If it works in the command line but not in Eclipse then it must mean that src is not your current working folder. I'm guessing the project folder is the current folder.
Do you get an error when running from Eclipse or the program just terminates? If there is no error, then your file is created somewhere else. Do a search on your hard-drive for it.
Just as a test, when running your program from Eclipse, just before the code you posted, add the following and see where it points to:
System.out.println(System.getProperty("user.dir"));