I have a group of Java utility classes that aren't in packages, and they each look roughly like this:
public class MyExample {
// Code
}
Depending on where the class is needed, I want to give it a specific package name, like this:
package myExamplePackage;
public class MyExample {
// Code
}
But, I want to add this package name and compile it without creating a temporary intermediate file. I'd like to do this as a one-liner as well, because this command will be in a Makefile and I don't think you can have loops in a Makefile.
What I have right now is:
sed '1i package myExamplePackage;' ../myUtilities/MyExample.java | javac
This almost works for a single file -- the sed works, but javac doesn't like the stream. Is there a way to get javac to like the stream and incorporate a loop here?
Or am I making things too complicated, and there's an easier way to do this altogether?
I'd appreciate any help.
Thanks,
Zel2008

New Topic/Question
Reply




MultiQuote




|