This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Ant, Maven and Other Build Tools and the fly likes java hangs when run build in background Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "java hangs when run build in background" Watch "java hangs when run build in background" New topic
Author

java hangs when run build in background

Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30353
    
150

I have a build file that runs a Java program. I've been able to simplify the problem to the point where I'm left with a build file that compiles and runs the program along with a program that just does a System.out.println.

When I run the build in Windows or UNIX (foreground), it works as expected. All the build.xml echos are output as is the System.out.println. When I run the program in the background, it appears to hang. It writes "end compile" to the log file (where System.out is redirected to.) If I run the "jobs" command, it shows as STOPPED which is odd. If I type "fg" it continues to run.

The same effect occurs if I remove the println and have a Java file that does nothing.

I've run builds before in the background. The major difference being that they don't call <java>. Any ideas what is going on? I'm at a loss for why the program goes into stopped state.

Note: The problem exists even if I don't fork the JVM. (The fork is there because the real program needs to fork.)





[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30353
    
150

Oddly enough, <exec> doesn't cause this problem. I guess I'm using <exec> to call Java as a workaround.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: java hangs when run build in background