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

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.