# How to create an exe file from julia code?

**URL:** <https://discourse.julialang.org/t/how-to-create-an-exe-file-from-julia-code/30004>\
**Category:** General Usage\
**Created:** [October 16, 2019, 11:23pm UTC](https://discourse.julialang.org/t/how-to-create-an-exe-file-from-julia-code/30004 "2019-10-16T23:23:14Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![pdeffebach](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pdeffebach/32/10320_2.png) [@pdeffebach](https://discourse.julialang.org/u/pdeffebach)\
**Post date:** [October 17, 2019, 12:38pm UTC](https://discourse.julialang.org/t/how-to-create-an-exe-file-from-julia-code/30004/21 "2019-10-17T12:38:45Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![vinod\_kc](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vinod_kc/32/10857_2.png) [@vinod\_kc](https://discourse.julialang.org/u/vinod_kc)\
**Post date:** [October 17, 2019, 12:53pm UTC](https://discourse.julialang.org/t/how-to-create-an-exe-file-from-julia-code/30004/22 "2019-10-17T12:53:21Z")

</div>

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 ?

---

<div class="post-metadata">

**Author:** ![vinod\_kc](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vinod_kc/32/10857_2.png) [@vinod\_kc](https://discourse.julialang.org/u/vinod_kc)\
**Post date:** [October 17, 2019, 12:58pm UTC](https://discourse.julialang.org/t/how-to-create-an-exe-file-from-julia-code/30004/23 "2019-10-17T12:58:15Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![pdeffebach](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pdeffebach/32/10320_2.png) [@pdeffebach](https://discourse.julialang.org/u/pdeffebach)\
**Post date:** [October 17, 2019, 1:03pm UTC](https://discourse.julialang.org/t/how-to-create-an-exe-file-from-julia-code/30004/24 "2019-10-17T13:03:11Z")

</div>

Take a look at the documentation for creating packages [here](https://julialang.github.io/Pkg.jl/stable/creating-packages/). 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.

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [October 17, 2019, 1:10pm UTC](https://discourse.julialang.org/t/how-to-create-an-exe-file-from-julia-code/30004/25 "2019-10-17T13:10:45Z")

</div>

> [@vinod\_kc](#):
>
> if it is not capable to make an exe, then it is useless for me. I can’t even send the programs to my friends to try. However, i love the syntax of Julia.

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

> **[GitHub - JuliaLang/PackageCompiler.jl: Compile your Julia Package](https://github.com/JuliaLang/PackageCompiler.jl#building-an-executable)**
>
> Compile your Julia Package. Contribute to JuliaLang/PackageCompiler.jl development by creating an account on GitHub.

---

<div class="post-metadata">

**Author:** ![vinod\_kc](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vinod_kc/32/10857_2.png) [@vinod\_kc](https://discourse.julialang.org/u/vinod_kc)\
**Post date:** [October 17, 2019, 1:13pm UTC](https://discourse.julialang.org/t/how-to-create-an-exe-file-from-julia-code/30004/26 "2019-10-17T13:13:52Z")

</div>

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.”

---

<div class="post-metadata">

**Author:** ![vinod\_kc](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vinod_kc/32/10857_2.png) [@vinod\_kc](https://discourse.julialang.org/u/vinod_kc)\
**Post date:** [October 17, 2019, 1:16pm UTC](https://discourse.julialang.org/t/how-to-create-an-exe-file-from-julia-code/30004/27 "2019-10-17T13:16:36Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Zach\_Christensen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/zach_christensen/32/7220_2.png) [@Zach\_Christensen](https://discourse.julialang.org/u/Zach_Christensen)\
**Post date:** [October 17, 2019, 2:11pm UTC](https://discourse.julialang.org/t/how-to-create-an-exe-file-from-julia-code/30004/28 "2019-10-17T14:11:07Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [October 17, 2019, 2:14pm UTC](https://discourse.julialang.org/t/how-to-create-an-exe-file-from-julia-code/30004/29 "2019-10-17T14:14:43Z")

</div>

It’s kind of borderline. People use Python and Perl scripts as “executables” via [shebang](https://en.wikipedia.org/wiki/Shebang_(Unix)) or other mechanisms all the time. Other scripting languages are used less, but it is feasible for almost all of them.

---

<div class="post-metadata">

**Author:** ![Zach\_Christensen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/zach_christensen/32/7220_2.png) [@Zach\_Christensen](https://discourse.julialang.org/u/Zach_Christensen)\
**Post date:** [October 17, 2019, 2:23pm UTC](https://discourse.julialang.org/t/how-to-create-an-exe-file-from-julia-code/30004/30 "2019-10-17T14:23:05Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [October 17, 2019, 2:26pm UTC](https://discourse.julialang.org/t/how-to-create-an-exe-file-from-julia-code/30004/31 "2019-10-17T14:26:11Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ggggggggg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ggggggggg/32/265_2.png) [@ggggggggg](https://discourse.julialang.org/u/ggggggggg)\
**Post date:** [October 17, 2019, 3:20pm UTC](https://discourse.julialang.org/t/how-to-create-an-exe-file-from-julia-code/30004/32 "2019-10-17T15:20:30Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![affans](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/affans/32/11911_2.png) [@affans](https://discourse.julialang.org/u/affans)\
**Post date:** [October 17, 2019, 3:38pm UTC](https://discourse.julialang.org/t/how-to-create-an-exe-file-from-julia-code/30004/33 "2019-10-17T15:38:20Z")

</div>

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”.

---

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [October 17, 2019, 3:44pm UTC](https://discourse.julialang.org/t/how-to-create-an-exe-file-from-julia-code/30004/34 "2019-10-17T15:44:06Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![phelipe](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/phelipe/32/14643_2.png) [@phelipe](https://discourse.julialang.org/u/phelipe)\
**Post date:** [October 17, 2019, 3:55pm UTC](https://discourse.julialang.org/t/how-to-create-an-exe-file-from-julia-code/30004/35 "2019-10-17T15:55:25Z")

</div>

Have you tried [ApplicationBuilder](https://github.com/NHDaly/ApplicationBuilder.jl) ?

---

<div class="post-metadata">

**Author:** ![vinod\_kc](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vinod_kc/32/10857_2.png) [@vinod\_kc](https://discourse.julialang.org/u/vinod_kc)\
**Post date:** [October 18, 2019, 11:06am UTC](https://discourse.julialang.org/t/how-to-create-an-exe-file-from-julia-code/30004/36 "2019-10-18T11:06:52Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![vinod\_kc](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vinod_kc/32/10857_2.png) [@vinod\_kc](https://discourse.julialang.org/u/vinod_kc)\
**Post date:** [October 18, 2019, 12:05pm UTC](https://discourse.julialang.org/t/how-to-create-an-exe-file-from-julia-code/30004/37 "2019-10-18T12:05:42Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![RK\_aus\_S](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rk_aus_s/32/12762_2.png) [@RK\_aus\_S](https://discourse.julialang.org/u/RK_aus_S)\
**Post date:** [February 10, 2020, 2:59pm UTC](https://discourse.julialang.org/t/how-to-create-an-exe-file-from-julia-code/30004/38 "2020-02-10T14:59:58Z")

</div>

> [@vinod\_kc](#):
>
> I am ready to wait for the exe building feature.

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.

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [February 10, 2020, 3:17pm UTC](https://discourse.julialang.org/t/how-to-create-an-exe-file-from-julia-code/30004/39 "2020-02-10T15:17:54Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![path-doc](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/path-doc/32/19183_2.png) [@path-doc](https://discourse.julialang.org/u/path-doc)\
**Post date:** [November 4, 2020, 9:45am UTC](https://discourse.julialang.org/t/how-to-create-an-exe-file-from-julia-code/30004/40 "2020-11-04T09:45:15Z")

</div>

@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?

[Previous page](https://discourse.julialang.org/t/how-to-create-an-exe-file-from-julia-code/30004.md?page=1)

[Next page](https://discourse.julialang.org/t/how-to-create-an-exe-file-from-julia-code/30004.md?page=3)
