Results 1 to 2 of 2
  1. #1
    amit9827 is offline Member
    Join Date
    May 2014
    Posts
    1
    Rep Power
    0

    Default how to make jar file compatible for all window machines

    I made the program below in java and compiled with javac command in Window7 (64bit machine). It simply post my machine IP and Mac address to my server application.

    When i run this script with java as >java Macregister
    I get what is expected, the program runs well on my machine.

    When I try to run it on other machines (Win8 - 32 Bit) I get error message and nothing works.
    My problem is 1) to make it compatible for all machines 2) to convert it into JAR application so that it is self executable on different machines.

    I am a new to Java and am struct, please help me out.

    Thankyou!!


    --------------------------------------------------------------------

    import java.net.*;
    import java.io.*;

    public class Macregister{
    public static void main(String[] args) throws Exception {

    InetAddress add=InetAddress.getLocalHost();



    NetworkInterface network = NetworkInterface.getByInetAddress(add);

    byte[] mac = network.getHardwareAddress();
    StringBuilder sb = new StringBuilder();
    for (int i = 0; i < mac.length; i++) {
    sb.append(String.format("%02X%s", mac[i], (i < mac.length - 1) ? "-" : ""));
    }







    String content="mac=" +"1"+"&ip=" +"0";
    URL oracle = new URL("http://192.168.1.196/client/testjava.php?mac="+sb.toString()+"&ip="+add.getHos tAddress());

    BufferedReader in = new BufferedReader(
    new InputStreamReader(oracle.openStream()));

    String inputLine;
    while ((inputLine = in.readLine()) != null)
    System.out.println(inputLine);
    in.close();
    }
    }

  2. #2
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,365
    Rep Power
    6

    Default Re: how to make jar file compatible for all window machines

    Perhaps you can't, your application may not work on all machines due to:

    a) there being no runtime that is compatible with your application (or is correctly installed)
    b) the user rights now allowing your application to do what it is supposed to do

    If at this point you want help to see what is the truth, you'd do well to post the actual error you are getting.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

Similar Threads

  1. How to make it so it fit window
    By SpicyElectricity in forum AWT / Swing
    Replies: 6
    Last Post: 02-18-2012, 12:33 PM
  2. How to make it so it fit window
    By SpicyElectricity in forum New To Java
    Replies: 3
    Last Post: 02-17-2012, 11:51 PM
  3. How can I make this Android compatible?
    By biondizzle in forum Android
    Replies: 0
    Last Post: 05-23-2011, 09:18 PM
  4. How do you make another window appear
    By robertbob in forum AWT / Swing
    Replies: 5
    Last Post: 05-22-2010, 08:05 PM
  5. how to make window active and textfield focused
    By whwillisiv in forum New To Java
    Replies: 0
    Last Post: 04-28-2009, 05:06 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •