• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Running Java application after closing command prompt

 
Bhagirathi Mallick
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 12084
29
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Jon Mithe
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2939
59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ah yeah that would do the trick, convenient
 
Randall Twede
Ranch Hand
Posts: 4363
2
Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
of course if you make it a jar you don't need the command prompt window at all
 
Bhagirathi Mallick
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5125
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There's something I'm not getting here. You want a console application to keep running after you close the console?
 
Tony Docherty
Bartender
Posts: 2939
59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12084
29
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic