Since java is a prefix of javac, this tends to confound using command completion (e.g. !j
in the Cshell).
In your .cshrc should be the following command definitions:
alias jc 'javac
\!$.java'
#compile
java
alias je
'java'
#execute
alias jx 'javac
\!$.java ; java \!$'
#compile and execute
Example
usage:
jc Hello
# same as javac Hello.java
je Hello
# same as java Hello
jx
Hello
# same as javac
Hello.java; java Hello 
Then use !jc, !je, or !jx to re-do previous commands
of same type.