May 31, 1998

Cross-platform socket communication

Question: I am writing a server written in Java that needs to take input from a game written in Visual Basic and sends the output to clients on the Internet. I’m having a really hard time getting data from a socket connection initiated from the VB code (standard Winsock OCX).

Object passing between threads

Question: Am implementing a network simulation program thatrequires a sender and receiver thread, with a frame object being passed between the two threads.Could you suggest a way of connecting the threads by means of an object stream that would allow the object to be passed between the two threads.What is

Java and videoconferencing

Question: I am conducting a study of operating system capabilities to support desktop videoconferencing.Would Java be a good Operating System for this purpose? Answer: Java itself is not an operating system, althoughSun Microsystems has created an operatingsystem called JavaOS which can lead to someconfusion. In response to your question, Ido

File permissions

Question: How do you change UNIX file permissions in Java? I’ve seen it done and I need to replicate it. Answer: There is no platform-independent way of changingfile permissions in Java. To do so, you eitherhave to write native code, or exec a localprogram to do the work for you.

StringTokenizer

Question: After: StringTokenizer st = new StringTokenizer(line); Do I have to write: String key = new String(st.nextToken()); or is it enough to write: String key = st.nextToken(); Answer: It is sufficient to write String key = st.nextToken(); The nextToken() method will allocate a newString containing the next token and returnit.

Environment Variables

Question: How do I access environment variables? Answer: There is an undocumented method in java.lang.System with the signature: public static String getenv(String) You can use this method to fetch the stringvalues of environment variables. However,this method is deprecated and will surelysoon disappear because not all platformssupport the concept of environment

Templates in java

Question: Any suggestions on a good way to implement templates in java? Answer: The normal way to implement template behaviorin Java is to create an interface defining thecommon behavior that is being abstracted. Everyclass that would normally would be instantiatedas a template in C++, would have to implementthis interface in

Clipboard

Question: I’m having problems with application clipboard usage for “non strings”. If I try to create my own dataflavor it still seems to think the clipboard is a string. Answer: Java 1.1 only supports interacting with thesystem clipboard using String data types.In Java 1.2 you will be able to cut

Can Java be compiled as excutable Win95 program?

Question: I am curious if Java can be compiled as Windows 95 executable program? Answer: Yes, various Java compilers now support the optionto compile Java directly to native code. Visual Cafe 2.5 and Asymmetric’s SuperCede are two suchJava development products that support this.