The ps command is better suited for this kind of task. Try something like this:

$ ps -ao bsdstart,fuser,pid,%cpu,%mem,args | grep jre

From the ps man page:

ps displays information about a selection of the active processes. If
you want a repetitive update of the selection and the displayed
information, use top(1) instead.

In the command I suggested, the option '-a' tells ps to print processes for all users. The -o specifies the output format. In my example (again from the ps man page):

bsdstart : time the command started. If the process was
started less than 24 hours ago, the output format
is " HH:MM", else it is " Mmm:SS" (where Mmm is
the three letters of the month). See also
lstart, start, start_time, and stime.
fuser : filesystem access user ID. This will be the
textual user ID, if it can be obtained and the
field width permits, or a decimal representation
otherwise.
pid : a number representing the process ID (alias tgid).
%cpu : cpu utilization of the process in "##.#" format.
Currently, it is the CPU time used divided by the
time the process has been running
(cputime/realtime ratio), expressed as a
percentage. It will not add up to 100% unless
you are lucky. (alias pcpu).
%mem : ratio of the process's resident set size to the
physical memory on the machine, expressed as a
percentage. (alias pmem).
args : command with all its arguments as a string.
Modifications to the arguments may be shown. The
output in this column may contain spaces. A
process marked <defunct> is partly dead, waiting
to be fully destroyed by its parent. Sometimes
the process args will be unavailable; when this
happens, ps will instead print the executable
name in brackets. (alias cmd, command). See
also the comm format keyword, the -f option, and
the c option.
When specified last, this column will extend to
the edge of the display. If ps can not determine
display width, as when output is redirected
(piped) into a file or another command, the
output width is undefined (it may be 80,
unlimited, determined by the TERM variable, and
so on). The COLUMNS environment variable or
--cols option may be used to exactly determine
the width in this case. The w or -w option may
be also be used to adjust width.

You can change this to suit your needs. Have a look at man ps and search for "STANDARD FORMAT SPECIFIERS" (you can use vi-style search in man pages, hit "/" and enter your search pattern, "n" will move to the next match).

Actually, it doesn't work right. if I just ran the top & grep commands together (i.e. without you line) it seems to show more results....
–
neildeadmanAug 28 '12 at 14:33

@neildeadman It will show more lines if you are not using the -n1 option.
–
terdonAug 28 '12 at 14:38

but with the -n 1 and not your additional commands it shows 4 lines, but with your additional lines and the -n 1 it shows 1 line and sometimes 3 or 4.
–
neildeadmanAug 28 '12 at 14:41

@neildeadman Another problem is that the output of top is strange. It manipulates the terminal somehow. If you tell me what exactly you need to do (what information do you want from top's headers for example), I should be able to give you a working command using ps.
–
terdonAug 28 '12 at 14:45