27.04.2013 Views

330 Java Tips.pdf - FTP Server

330 Java Tips.pdf - FTP Server

330 Java Tips.pdf - FTP Server

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Operational Systems & <strong>Java</strong><br />

Receive our newsletter with new tips! Almost 6,000 subscribers (by June 2001) can not be wrong!<br />

They read our tips every week! To subscribe to The <strong>Java</strong> FAQ Daily send empty e-mail to:<br />

javafaq-tips-subscribe@topica.com or visit at:<br />

http://www.topica.com/lists/javafaq-tips/<br />

Operational Systems & <strong>Java</strong><br />

Is anyone aware of any way to determine OS type, version...<br />

Answer: There is in the java.lang.System<br />

try first:<br />

Properties p = System.getProperties();<br />

System.out.println(p);<br />

to see what properties you can get(CPU among others)..<br />

you then can:<br />

String prop = System.getProperty("aproperty(the CPU among other)");<br />

Does anyone know if there is an easy way to invoke UNIX shell scripts from a<br />

<strong>Java</strong> application.<br />

Visit us here and you will find<br />

much more tips!<br />

Answer: There is!<br />

execute a shell and then write the name of the shell script on the shells stdin stream.<br />

Process child = rtime.exec("/bin/bash");<br />

BufferedWriter outWriter = new BufferedWriter(new<br />

OutputStreamWriter(child.getOutputStream()));<br />

outWriter.writeLine("filename");<br />

outWriter.flush();<br />

Is there a way to differentiate the enter key on the main keyboard from the enter<br />

key on the keypad?<br />

Answer: I don't think so, they're both represented by the character code 10.<br />

Is there any way to manage Systray Icons with <strong>Java</strong>? I didn't even find anything in<br />

the Microsoft packages...<br />

file:///F|/350_t/350_tips/os_win_linux.htm (1 of 8) [2002-02-27 21:18:56]

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!