How do I get platform specific info in Java
Hi,
I am coding in Java the skeletal structure of a program that uses the p2p system. A centralized server communicates with the clients and when clients want to transfer some file or sth, the server initializes the p2p between the clients. The communication protocol I am working on is pretty simple for start. The main concern for me is to start the server and the clients on boot. I can achieve this using init scripts at rc* in *IX. But about windows, I am going to use the "reg" system command to add my program at the registry. But looks like its hell of a registry job to do and am not so good at win32 registry hack. My query, "Is there a generic way I can make my application start at boot time using any java classes?" :scratch: And I want to know detail about the platform my application is currently running on. How do I fetch that?:rolleyes: Any suggestion is welcome. :) |
Java was created to hide platform specific details from developers. If you need hardware access, use JNI (java native interface) to call OS specific libraries. However, this way your program will need to determine it's working environment and make calls accordingly. Btw, check Java API Runtime class.
How to start a program at boot time is not a java api problem. It should be users prerogative, so each user should modify their environment accordingly. |
Quote:
I know System.getProperty is one of the methods, but its doesn't have a rich set of parameters to get system info. Is there any other way? Plz help... |
Code:
Key Description of Associated Value |
Dear Alien_Hominid,
Thanks for the keys. I find it very useful. Thats all I needed. :D Actually I will be using win32 registry (by using a system call to reg once I know its win32) to add my application to the Windows startup. For UNIX (actually on Solaris mainly), I will be able to put it up as service in the SMF. I will now be able to do all that in no time.:) Thanks again. devN :jawa: |
np. I just pasted from manual.
|
All times are GMT -5. The time now is 06:13 PM. |