This discussion is archived
3 Replies Latest reply: Feb 28, 2013 5:36 AM by Kayaman RSS

Make Java program run on other pc's

796618 Newbie
Currently Being Moderated
Good afternoon,

So I have this Java program compiling on my pc through NetBeans.

Now if I want this program to run on other pc's on its own (without NetBeans or any other program), preferably through a GUI, do I have to convert it to a JAR file? How does this exactly works out?

Thanks for your help.
  • 1. Re: Make Java program run on other pc's
    PhHein Guru Moderator
    Currently Being Moderated
    Have a look at the jar tutorial:
    http://docs.oracle.com/javase/tutorial/deployment/jar/
  • 2. Re: Make Java program run on other pc's
    Kayaman Guru
    Currently Being Moderated
    alley wrote:
    Now if I want this program to run on other pc's on its own (without NetBeans or any other program), preferably through a GUI, do I have to convert it to a JAR file? How does this exactly works out?
    You don't have to pack it into a JAR file, but it's often the most convenient way. That way it'll be a single file and if the computer (and your file) has correct settings, you can just double click on the jar to run the program.

    I recommend some Google research on JAR files and what's the easiest way to create them from Netbeans.
  • 3. Re: Make Java program run on other pc's
    gimbal2 Guru
    Currently Being Moderated
    alley wrote:
    So I have this Java program compiling on my pc through NetBeans.
    And Netbeans does it using the JDK. it is always the JDK, no matter how many tools you wrap around it on top. You don't need Netbeans to run your stuff either, it is merely a development convenience that Netbeans provides you.
    >
    Now if I want this program to run on other pc's on its own (without NetBeans or any other program)
    Impossible - you need at least a compatible Java runtime.
    , preferably through a GUI
    You mean by double clicking on the program icon through the OS?
    , do I have to convert it to a JAR file?
    That would be an easy way yes - an executable jar to be more precise
    How does this exactly works out?
    Netbeans builds the jar automatically, just check out the folders of your project to find it. If you set a main class in the project properties, it is even an executable jar. Double click it and if the Java runtime is properly setup (which tends to be the case when it installs succesfully, but many people manage to screw it up in a way I can't imagine anyway), it will run.

    For further guidance, check the online netbeans manual and research executable jars.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points