This discussion is archived
9 Replies Latest reply: Mar 20, 2013 1:10 AM by gimbal2 RSS

Java Begineer at GUI

993724 Newbie
Currently Being Moderated
I am a very beginner in java, just doing some classes and projects but I have a question "will be very silly to you sure"
if I made a program with GUI at NetBeans for example, after run it, does that provide a stand alone application on desktop, for example to re use that program again without running on NetBeans or calling it from the commander.
  • 1. Re: Java Begineer at GUI
    gimbal2 Guru
    Currently Being Moderated
    Netbeans is your development environment and only a pretty shell around that thing called "java". You can do everything without it, including compiling your application and yes also run it. You should spend some time learning proper java, not java hidden behind netbeans. Then you wont have to ask these kind of questions anymore.
  • 2. Re: Java Begineer at GUI
    rp0428 Guru
    Currently Being Moderated
    >
    I am a very beginner in java, just doing some classes and projects but I have a question "will be very silly to you sure"
    if I made a program with GUI at NetBeans for example, after run it, does that provide a stand alone application on desktop, for example to re use that program again without running on NetBeans or calling it from the commander.
    >
    Stand alone application? What do you mean by that?

    It will typically, by default create a jar file when you 'Build' the project.

    If you right-click on a project in the project tree and select 'properties -> Build -> Packaging' you will see the name and location of the jar file that is built.

    If that jar file has a 'main' method you should be able to just double-click on it to run the application. That will only work if it does not require you to specify command line arguments.
  • 3. Re: Java Begineer at GUI
    996244 Newbie
    Currently Being Moderated
    I am also in learning process and not much know about java yet. I was join this forum to learn about java and all this type of posts are helpful for me. i hope i learn a lot of things from here.
  • 4. Re: Java Begineer at GUI
    gimbal2 Guru
    Currently Being Moderated
    993241 wrote:
    I am also in learning process and not much know about java yet.
    Start with learning the language and for that Netbeans is just fine - in fact it is a big help. When you get to that point where you want to learn how to build real applications, with multiple classes and packaging them up in such a way that they are easy to run, that is the moment where you have to let Netbeans go for a moment and learn about concepts such as the classpath, packages and all the JDK tools (java, javac, jar) using nothing but the command prompt. When you have a firm understanding of how all these things work and how you can use them to build, package and run your Java applications, you can return to Netbeans again and let it help you make all that stuff very easy. But Netbeans will be in your way if you don't firmly understand first.
  • 5. Re: Java Begineer at GUI
    996244 Newbie
    Currently Being Moderated
    Nice tips, i will try to follow them.
  • 6. Re: Java Begineer at GUI
    morgalr Explorer
    Currently Being Moderated
    Yes, and no... as mentioned earlier JAR files are the target of NetBeans, and if you have an appropriate main class in your application, then NetBeans will make an executable jar file for you. What this means is that it will run on your computer or any computer with an appropriate JVM running. It is not a stand alone: if you put it on a computer that does not have an appropriate JVM running, then it will not run.

    You need an additional tool to make a native executable for your OS.
  • 7. Re: Java Begineer at GUI
    gimbal2 Guru
    Currently Being Moderated
    morgalr wrote:
    You need an additional tool to make a native executable for your OS.
    An additional third party tool I might add, don't go looking for one on the Oracle download site. Although JavaFX 2.1 nowadays comes with a native wrapper generator I believe.
  • 8. Re: Java Begineer at GUI
    morgalr Explorer
    Currently Being Moderated
    Yeppers... 3rd party tool, but now that Windows 8 is a scripted nightmare, I just keep Java in the executable JAR form--if MS trusts it's VM to do main apps, then surely I trust Java to do almost everything in 8... at least as far as Java was made to do.
  • 9. Re: Java Begineer at GUI
    gimbal2 Guru
    Currently Being Moderated
    morgalr wrote:
    Yeppers... 3rd party tool, but now that Windows 8 is a scripted nightmare, I just keep Java in the executable JAR form
    As it was intended. I like the Minecraft approach though, to have a separate optional launcher application which is native.

Legend

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