How to create an exe file from julia code?

No, but having them download julia, then telling them to add your project from github will work.

1 Like

Its ok, and i can run jl file easily. But what if i send to this my friends ? Do they also need to install julia ?

Could you please explain the steps a little more ? I mean Now, this is in my mind

  1. They (my users) need to download and install julia from web
  2. They have my jl files which i sent to them.
    . Do they need to be added to Julia’s Path in Environment Variables list?

Take a look at the documentation for creating packages here. What you should do is create a package, using Pkg.generate or PkgTemplates.jl, and when developing the package, use a separate environment for that package so that the project.toml keeps track of what your dependencies are.

Then put it on github. Then tell your friends to download Julia (which is an easy thing to do!). Then tell them to open up the julia prompt and do using Pkg; Pkg.add("link_to_github").

Then they can call PkgName.main() and the Julia will run whatever fun things you have put in your main() function.

Then I am afraid that, at the moment, Julia is not yet ready for this purpose.

Making a self-contained executable is work in progress, with some partial results and demos. You may want to check updates on this later, and keep an eye on

Actually, the reality is, we cant tell our users to use CMD in windows. Its considering as something geeky. They all want an exe file to double click and run. And same is with git hub. Normal Windows users hate to use typing. They want to click with mouse and run the program. If we tell them to use cmd and keyboard, then they will give a reply like this - “Its in the old dos days. Now we have mouse and icons.”

4 Likes

Thanks for the reply. I just tried it but i failed because, there are a lot things which is not clear to me. So i am searching for a good tutorial about PackageCompiler in web.

I didn’t think that using a “.jl” file as an executable was part of its intended use. I’m not really a programmer by trade so I may be off here, but isn’t that like double clicking on a “.txt” file and it running cat file.txt. I always assumed executables would be entirely different file types of completely compiled code.

It’s kind of borderline. People use Python and Perl scripts as “executables” via shebang or other mechanisms all the time. Other scripting languages are used less, but it is feasible for almost all of them.

That’s interesting. I wasn’t aware of this convention extending beyond shell scripting. I’ve only ever seen it for bash or tcsh when sending stuff to a super computer. Is this default behavior (not user configured) on any system for things like python, r, or matlab?

I think it works for all Unix systems. But has some limitations, eg the need for absolute or relative paths in the scripts (AFAIK you cannot do lookup in PATH). So it is not super-robust.

2 Likes

Could you get your application working on some online platform, like JuliaBox, NextJournal, etc, and share it that way?

I don’t think that’s what he’s looking for though. He wants to avoid all that because he wants to share with folks that might not be savvy enough or some other reason to run your steps. The solution of creating a script that downloads Julia, downloads the package, downloads and builds all the dependencies, sets up environmental variables is a possible solution if the user dosn’t care about waiting a few minutes after clicking their “binary”.

1 Like

A simple procedure would be to bundle up the batch file, your Julia source files, and the Julia distribution files into a zip file, and send your friends that. When they unzip and run your batch file it can install Julia, set up the environment, and then run your Julia files.

1 Like

Have you tried ApplicationBuilder ?

5 Likes

These are just workarounds. But in Windows, we need exes. In case of Go, it is not producing an exe when we run our code. But it can produce an exe with “build” command. Its so simple. Anyway, thanks for the reply. I am ready to wait for the exe building feature.

3 Likes

Seems good for me. Let me check it. Thanks a lot

I probably will too.
Somehow disappointing, I was very enthusiatic about the possibility to compile code to an *.exe (within Windows). Fortunately, there are other (less sophisticated) scripting languages which allow me to create exe’s until Julia is ready.
Regards.

3 Likes

PackageCompilerX allows you to do this: https://juliacomputing.github.io/PackageCompilerX.jl/dev/apps.html

4 Likes

@vinod_kc first thanks for this question. Can you confirm whether the latest version of Package Compiler solves your problem? And if so, what has changed since October 2019?