File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Running Java application after closing command prompt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Running Java application after closing command prompt" Watch "Running Java application after closing command prompt" New topic
Author

Running Java application after closing command prompt

Bhagirathi Mallick
Greenhorn

Joined: Jul 21, 2011
Posts: 26

I run my application in command prompt.
Now my application is running...
My requirement is that if some one closed command prompt still my application should run.
how it is possible...

If you people have any Idea, please replay on my post.

Thanks in advance.

fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11167
    
  16

Not sure what it would be called on windows, but in Unix, there is a "nohup" flag/argument/command you can give to keep the process running once the window is closed.

I'd try googling for "windows nohup" and see what you find.


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Jon Mithe
Greenhorn

Joined: Mar 11, 2013
Posts: 5
This isnt really a java issue. I'm not a OS expert, but if you run something from a command like, the process (i.e. you app / JVM) are a child so to speak of the command prompt process. I.e. kill the command prompt process and the operating system will kill all child processes / your app.

So this is OS specific executable stuff, i.e. you need to figure out a way to run it either not from a command prompt or disown it. Effectively something like the apps that wrap your java up into an executable or something.
Tony Docherty
Bartender

Joined: Aug 07, 2007
Posts: 2173
    
  47
I believe if you start the application using "javaw" rather than "java" you can then close the command prompt without it stopping the application.
Jon Mithe
Greenhorn

Joined: Mar 11, 2013
Posts: 5
ah yeah that would do the trick, convenient
Randall Twede
Ranch Hand

Joined: Oct 21, 2000
Posts: 4340
    
    2

of course if you make it a jar you don't need the command prompt window at all


SCJP
Visit my download page
Bhagirathi Mallick
Greenhorn

Joined: Jul 21, 2011
Posts: 26
Hi, Tony Docherty thank you for giving replay...

if i am using swing application then it is correct
But, I need the Command line console, i am not using swing application
is it possible or not...
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4523
    
    5

There's something I'm not getting here. You want a console application to keep running after you close the console?


luck, db
There are no new questions, but there may be new answers.
Tony Docherty
Bartender

Joined: Aug 07, 2007
Posts: 2173
    
  47
Darryl Burke wrote:There's something I'm not getting here.

That makes two of us.

Bhagirathi Mallick wrote:But, I need the Command line console, i am not using swing application
is it possible or not...

I've never written a Java application that requires absolutely no user interaction or feedback so I don't know - did you try it?
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11167
    
  16

Tony Docherty wrote:
Darryl Burke wrote:There's something I'm not getting here.

That makes two of us.

Bhagirathi Mallick wrote:But, I need the Command line console, i am not using swing application
is it possible or not...

I've never written a Java application that requires absolutely no user interaction or feedback so I don't know - did you try it?

I suppose if you have some file manipulation or heavy number crunching, you could have a program that just needs the input file name, and you know it's done when some new file shows up...but that's probably a stretch.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Running Java application after closing command prompt
 
Similar Threads
Failed to download and/or install client side AOP stack
Connection to remote DB server to run JDBC application program
Error when running a java program
Installing the Android SDK
problem to rin openoffice