os detection - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

os detection

Jean PaulJean Paul Posts: 7Member
Hi everybody!

I'd like to know the way to detect which os I'm running java on. I'm making a server using port 7(echo) under windows, but I can't use this port on Linux due to restriction.
That's the reason why a sub-program like this can help me a lot.

JP

Comments

  • bashirobashiro Posts: 244Member
    [b]
    try this

    [code]

    static {
    System.out.println("Detecting OS...");
    try {

    String os_name = System.getProperty("os.name", "");
    String os_version = System.getProperty("os.version", "");
    String platform_class = null;

    //if (os_name.startsWith("Mac OS X"))
    ...........
    if (os_name.startsWith("Window"))
    ...............
    [/code]
    If you need full example let me know

    bashiro

    [/b]

    : Hi everybody!
    :
    : I'd like to know the way to detect which os I'm running java on. I'm making a server using port 7(echo) under windows, but I can't use this port on Linux due to restriction.
    : That's the reason why a sub-program like this can help me a lot.
    :
    : JP
    :

  • itmprasitmpras Posts: 36Member
    : [b]
    : try this
    :
    : [code]
    :
    : static {
    : System.out.println("Detecting OS...");
    : try {
    :
    : String os_name = System.getProperty("os.name", "");
    : String os_version = System.getProperty("os.version", "");
    : String platform_class = null;
    :
    : //if (os_name.startsWith("Mac OS X"))
    : ...........
    : if (os_name.startsWith("Window"))
    : ...............
    : [/code]
    : If you need full example let me know
    :
    : bashiro
    :
    : [/b]
    :
    : : Hi everybody!
    : :
    : : I'd like to know the way to detect which os I'm running java on. I'm making a server using port 7(echo) under windows, but I can't use this port on Linux due to restriction.
    : : That's the reason why a sub-program like this can help me a lot.
    : :
    : : JP
    : :
    :
    :


    hi friends ,
    i am new to java programming , but having good back ground on c , c++
    just before 2 weeks i started studying java , i am very interested in network programming , i familier with network terms such as socket etc
    done some programs using winsock i don't where to start network programming pls show me a way thanks

    thanks
    pras

Sign In or Register to comment.