Prepend content to a file
Use sed with -i option. You can also specify the line to which the content will prepend to.
sed -i '' '1s/^/package home;/" Home.java
Prepend content to multiple files
Here I need to add a package to 200 java files. To do this manual would be tedios.
for f in *.java do sed -i "" "1s/^/package home;/" $f done