Operational Systems & Java
Shutdown hooks should also finish their work quickly. When a program invokes exit
the expectation is that the virtual machine will promptly shut down and exit. When the
virtual machine is terminated due to user logoff or system shutdown the underlying
operating system may only allow a fixed amount of time in which to shut down and
exit. It is therefore inadvisable to attempt any user interaction or to perform a
long running computation in a shutdown hook."
more read here: http://java.sun.com/j2se/1.3/docs/api/index.html
Q: I ve run into a somewhat exotic problem. I want to execute a command whose
argument (a filename) has spaces in it. Unix allows it...
I ve run into a somewhat exotic problem. I want to execute a command whose
argument (a filename) has spaces in it. Unix allows it [windows even encourages it,
what with Program Files etc] e.g.
cat silly file.txt
works in both sh and csh. However, those quotes (or a \ before the space) do not
work with Runtime.exec (), because it uses StringTokenizer with default delim
constructor to parse the command string. The dflt delims include space, so silly
file.txt spawns two tokens.
Answer: Use the "other" Runtime.exec, i.e. the one that takes an array of Strings.
Pass it your command line, pre tokenized:
String [] cmd = {"cat", "silly file.txt"};
Runtime.getRuntime (). Exec(cmd);
Gordon Beaton
Q: Is it possible for a minimized window in MS Windows task bar to start
blinking? In any IRC client a minimized window starts blinking when a new message
appears in it. Is it possible in Java?
Answer: I doubt very much that it is possible with pure java; you would have to use
some native code to achieve that. Maybe what you could try though, is to play
around with the icon used in the title bar of the frame. I haven t tried this myself and
in any case I m running linux, but it might be possible to have two icons and to switch
them around at some rate using the Frame.setIconImage(Image) method. This will
only affect the icon itself not the whole window, but it s better than nothing.
Allen Wallis
Q: How do I find the list of all system properties?
Answer: do smth like this:
Enumeration list = System.getProperties().propertyNames();
while(list.hasMoreElements()){
System.out.println((String) list.nextElement());
}
}
Is it cls like command in DOS (CMD) window? I would like to clean the screen the
user sees?
file:///F|/a_jsite/350_tips/os_win_linux.htm (5 of 8) [2001 07 08 11:24:58]
footer
Visionwebhosting.net Business web hosting division of Web
Design Plus. All rights reserved