In most cases, what you'll want is an "init script". Init scripts are started and stopped by the runlevel manager, and typically a Linux server will start up to either runlevel 3 (non-GUI, networked) or runlevel 5 (GUI). There's some interesting magic that gets applied to ensure that resource are running (or not) at a given runlevel and in the proper sequence so that pre-requisite resources are there (or not) when needed. It's not perfect, so Sun recently (Solaris 10) added an more sophisticated runlevel manager (not available to Linux, alas). And there's supposed to be improvements in the works for Linux as well, but they're slow in coming.
A typical runlevel script is headed up with some "magic comments" that the system can use to manage the script with. Red Hat/Fedora have one set, SuSe have another (with some overlap), and I forget the details from the Debian/Knoppix/Ubuntu platform. The master copies of the init scripts are stored in /etc/init.d, with aliases made to them to provide the actual runlevel control (this is typically done via the "chkconfig" utility). init scripts are expected to setup an environment (possibly starting a daemon) and returning. Don't make a long-running script, or it will hang the runlevel switching process, including the other apps.
The best thing to do is look at the scripts in your system's /etc/init.d directory. Some are pretty simple. Some are pretty nasty. But they'll help you get what you want.
Java apps are especially problematic, since the executable program's name is typically "java", rather than a unique appname, but there are tricks that can be done to make them reasonably co-operative.
Loudly announcing something is true and finding out you're wrong makes you feel foolish.
Finding out you're wrong and refusing to admit it makes you LOOK foolish.