In your user directory, there should be a file called .xprofile with permissions 0700.
In that file, there should be a line that reads
If there isn't, stop.
Otherwise add a line before that one, like this one:
Restart X(Ctrl-Alt-BkSp for preference), and try your Java app again.
What's also good--and will work even if you have no .xprofile file--is to make a shell script for any Java app you want to run, like this:
java -jar my_java_program.jar
Just make sure you chmod u+x your shell script, and leave it in a directory in your path.
-- da Geek