473,396 Members | 1,775 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

java is different from C

In C you can create a TRUE daemon which you start by executing it
and it severs itself from the terminal you started it from.

In java you can use javaw in windows, but in unix you would have to
do "nohup java programname &" . But this is not really a TRUE daemon
because if you now say "fg" it is back under command line control.

I read many examples and they all say that in java a daemon thread
will exit when there are no non-daemon threads because the JVM believes
that daemon threads are meant to provide support for non-daemon
threads.

Is all this correct ? I am trying to make a simple java socket server that
will run on a unix machine or windows machine. Are there any good
examples available say on a university website ?
Jul 17 '05 #1
3 2597
"mthlv12" <mt*****@earthlink.net> wrote in message
news:_d******************@newsread3.news.atl.earth link.net...
In C you can create a TRUE daemon which you start by executing it
and it severs itself from the terminal you started it from.

In java you can use javaw in windows, but in unix you would have to
do "nohup java programname &" . But this is not really a TRUE daemon
because if you now say "fg" it is back under command line control.

I read many examples and they all say that in java a daemon thread
will exit when there are no non-daemon threads because the JVM believes
that daemon threads are meant to provide support for non-daemon
threads.

Is all this correct ? I am trying to make a simple java socket server that will run on a unix machine or windows machine. Are there any good
examples available say on a university website ?


Which executable you use to start a Java program has no bearing on whether a
Thread is a daemon thread or not. This refers to whether the boolean daemon
member of a given Thread object is set to true. Any Java application must
have at least one non-daemon, started, and non-dead Thread at all times or
the application will terminate, along will any daemon Threads in it.
Jul 17 '05 #2
"mthlv12" <mt*****@earthlink.net> wrote in message
news:_d******************@newsread3.news.atl.earth link.net...
In C you can create a TRUE daemon which you start by executing it
and it severs itself from the terminal you started it from.

In java you can use javaw in windows, but in unix you would have to
do "nohup java programname &" . But this is not really a TRUE daemon
because if you now say "fg" it is back under command line control.

I read many examples and they all say that in java a daemon thread
will exit when there are no non-daemon threads because the JVM believes
that daemon threads are meant to provide support for non-daemon
threads.

Is all this correct ? I am trying to make a simple java socket server that will run on a unix machine or windows machine. Are there any good
examples available say on a university website ?


Oh, and in the future, please post to comp.lang.java.help or
comp.lang.java.programmer. This group isn't supposed to exist.
Jul 17 '05 #3
On Mon, 16 Aug 2004 22:06:50 GMT, mthlv12 wrote:
In java you can use javaw in windows, but in unix you would have to
do "nohup java programname &" . But this is not really a TRUE daemon
because if you now say "fg" it is back under command line control.


Try this instead:

( nohup java programname > /dev/null 2>&1 < /dev/null & ) &

Now you can't get it back with fg.

/gordon

--
[ do not email me copies of your followups ]
g o r d o n + n e w s @ b a l d e r 1 3 . s e
Jul 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

73
by: RobertMaas | last post by:
After many years of using LISP, I'm taking a class in Java and finding the two roughly comparable in some ways and very different in other ways. Each has a decent size library of useful utilities...
7
by: Jan Gregor | last post by:
Hello I found that jython catches exact java exceptions, not their subclasses. Is there some way to get around this limitation (or error) ? My program has class representing database source...
114
by: Maurice LING | last post by:
This may be a dumb thing to ask, but besides the penalty for dynamic typing, is there any other real reasons that Python is slower than Java? maurice
133
by: Gaurav | last post by:
http://www.sys-con.com/story/print.cfm?storyid=45250 Any comments? Thanks Gaurav
1
by: David Van D | last post by:
Hi there, A few weeks until I begin my journey towards a degree in Computer Science at Canterbury University in New Zealand, Anyway the course tutors are going to be teaching us JAVA wth bluej...
458
by: wellstone9912 | last post by:
Java programmers seem to always be whining about how confusing and overly complex C++ appears to them. I would like to introduce an explanation for this. Is it possible that Java programmers...
2
by: Jobs | last post by:
Download the JAVA , .NET and SQL Server interview with answers Download the JAVA , .NET and SQL Server interview sheet and rate yourself. This will help you judge yourself are you really worth of...
15
by: Xah Lee | last post by:
On Java's Interface Xah Lee, 20050223 In Java the language, there's this a keyword “interface”. In a functional language, a function can be specified by its name and parameter specs....
5
by: r035198x | last post by:
Setting up. Getting started To get started with java, one must download and install a version of Sun's JDK (Java Development Kit). The newest release at the time of writting this article is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.