0

I need to detect client side OS version and whether it's 32 bit/64 bit (Windows XP (32-bit) / Mac OS X 10.3.x / Linux OpenSUSE 11.2 etc.) using Applet. I will have to load the applet automatically when the JSP will be loaded and it will show all the correct information regarding user's OS. Please help me.

asked Jun 29, 2011 at 18:39

2 Answers 2

2

You can use java.lang.System to get basic information about the system your code is running on. Not sure if you want something more detailed than that.

System.out.println(System.getProperty("os.name"));
System.out.println(System.getProperty("os.arch"));
System.out.println(System.getProperty("os.version"));

Properties available via java.lang.System.getProperties() are listed here.

Edit:

The system properties for os.name, os.arch and os.version are not garaunteed to give you useful information. It depends highly on the platform and JVM you are using. If you want an analogy you can think of it as being roughly as useful as the user agent property property sent in HTTP requests (so, barely useful). There are some third party tools you can use for getting better system information, but you will have to sign your applet in order to get them to work, as they require permissions on the system that fall outside the Applet Security Sandbox. For example, SIGAR by HyperInc which was mentioned on this SO post.

Finally, to get your Applet to load on your page you need to include it on the page using applet tags. Heres an example:

Some more examples of applet tags are shown on Oracle's site.

Hope this helps.

answered Jun 29, 2011 at 18:45
Sign up to request clarification or add additional context in comments.

4 Comments

Thank you perception for your reply...I did the same thing but it's not reliable...It's not always detecting the correct version and the bit information. It would be nice if you can tell me some other solution. And second thing can you tell me that how to load the applet on load time of body. Actually I have not worked with applet before.
@Neel, yes those system properties are very basic like I mentioned in my answer. I did some edit's since you need more specific information than what is easily available just using java.lang.System. I would recommend just getting your applet working first with the basic information, before incorporating any third party libraries and having to sign your jar.
@perception- I have tried SIGAR,it's fine.But it can't be used as I need the information about the client machine's OS means the remote OS as it is a web project. I would have done it using user agent but I have to use Applet and detect using java.
@Neel - whats the problem with bundling the SIGAR jar along with your applet code and running it on the client? I haven't used it personally but theoretically this should work.
0

You'll probably have as much luck parsing the User-Agent http header. You can either pass them to the applet using JavaScript or have the applet directly read them.

answered Jun 29, 2011 at 19:17

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.