Java Package Correction
Mathematica, 106 bytes
StringReplace[Rest@#~StringRiffle~&quot;\n&quot;,&quot;package &quot;~~__~~&quot;;&quot;-&gt;&quot;package &quot;&lt;&gt;#[[1]]&lt;&gt;&quot;;&quot;]&amp;@StringSplit[#,&quot;\n&quot;]&amp;

Works by splitting the string into its lines and returning all but the first line with any package declarations replaced with the new package.