You can't compile & run just one file in Eclipse without the file being in a java project.
It is a very quick and easy process to create a Java Project in eclipse.
File -> New -> Java Project
You can use the default package (though it is not recommended) and put your single file in it and run it.