Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New Coder
    Join Date
    Aug 2008
    Posts
    14
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Question Converting.java to .exe ?

    Question

    Is there a way to Convert a .java file to an exe file

    i use NetBean 6 and i have a source folder in that src folder

    a main java project file .java (1) 1 file

    individual.java files (2) files

    now i want to convert this source folder with all the.java files to one .exe file to run under native Windows OS

    i have softwares such as

    JSmooth

    EXE4J



    i dont know how to do this in either 1 if there's a way i can convert that whole folder to an exe file would be very helpful
    for the completion of my software


    Solutions are welcome
    thanks

  • #2
    Regular Coder
    Join Date
    Apr 2005
    Location
    Ohio
    Posts
    254
    Thanks
    1
    Thanked 63 Times in 63 Posts
    Haven't tried it myself but this seems pretty straight forward:
    2.2. Creating your first exe

    Building your own EXE wrapper for your java application just needs a few simple steps: specify the name of the executable, define the main java class, optionally a classpath if it needs more than its own jar, and that's all.
    2.2.1. Quick Start

    The minimum data you need to start the creation of the binary executable for your application is to specify a classpath and the fully-qualified name of your main class. You can configure both in the Application panel (add new jars or directories using the icon with a yellow + sign, and type the class name in the Main Class field.

    Once done, go to the Windows Executable panel, and type the name of the executable in the Executable Name field. Do not forget to add the .exe suffix, for your executable name. Something like my-app.exe should be fine.

    Of course, you can specify many more options for the java wrapper, but this is enough for a basic java application. Now, click on the save button (or in the File+Save menu) and select a filename for the project. This is an important step, because all the path stored in the file, and displayed in the GUI are relative to this project file. Selecting a location under the root directory of your project is a good (and safe) choice.

    Once your project is saved, it is just a matter of clicking on the Project+Create Exe. And that's it. You can use the Project+Run Exe to run the program, or use the windows explorer to run the executable.
    Source: http://jsmooth.sourceforge.net/docs/...oc.html#N100B0

  • Users who have thanked shadowmaniac for this post:

    Inquisit (10-08-2008)

  • #3
    Regular Coder Aradon's Avatar
    Join Date
    Jun 2005
    Location
    USA
    Posts
    734
    Thanks
    0
    Thanked 20 Times in 19 Posts
    Most windows come with the JRE, if this is the case you shouldn't be creating an exe, but instead should be creating a jar file. JAR files are like exe's, but for Java only!

    http://java.sun.com/docs/books/tutorial/deployment/jar/
    "To iterate is human, to recurse divine." -L. Peter Deutsch

  • Users who have thanked Aradon for this post:

    Inquisit (10-08-2008)

  • #4
    New Coder
    Join Date
    Aug 2008
    Posts
    14
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Thanks im on it right now

  • #5
    New Coder
    Join Date
    Aug 2008
    Posts
    14
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Jar files need a JRE or IDE to run thats the disadvantage but with .exe it can be accessed anytime anywhere....

    thnaks appreciate your help on this one D..

  • #6
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,979
    Thanks
    4
    Thanked 2,659 Times in 2,628 Posts
    I'd have to disagree. An .exe will only work for the framework it was developed for - a Windows .exe is unlikely to be executable on Linux for example. This is why Java is advantageous with the JRE, so the bytecode can be dynamically interpreted by the host system. This takes the specific architecture away from the developer, making applications more portable. This is one of the advantages that Java has over C# (which will only run to its full extent on a Windows machine). The .NET framework also uses the MIL, so its taking the same approach to the interpreter as Java does.
    This of course, ignores emulations like cygwin and wine. If you want to make executable files, use C/C++.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 

  • #7
    New Coder
    Join Date
    Aug 2008
    Posts
    14
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Thumbs up

    all the same then is it possible converting to C" from .java then to exe from C# if you know of any software?

    anyways thanks though was helpful


  •  

    Posting Permissions

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