Can Julia be set up to run from Windows 10 command line? Docs say it runs from command line but the system does not find the file. AFAICS there are juliaup.exe, julialauncher.exe, and two copies of julia.exe on my system after I run Julia.appinstaller - I expect a path needs to be added to environment variables, but which one?
I think it can, albeit the recommended way is to use PowerShell.
I installed julia via juliaup and when I run this command I can launch julia
C:\Users\34682\.julia\juliaup\julia-1.12.5+0.x64.w64.mingw32\bin\julia.exe --project=.
e.g. you can put it inside a myj.ps1 file in the working directory.
And then you run ./myj in the PS terminal, this will open julia. (In this way you donât need to set up the environment variables.)
I installed Julia from the Microsoft Store on Win11, and for me julia automatically runs C:\Users\myusername\AppData\Local\Microsoft\WindowsApps\julia (which in turn is a link to the julialauncher, but thatâs an implementation detail). If you find a julia.exe at that path (with your username substituted in), then thatâs probably the best path to add in. Afaict itâs already supposed to be in your PATH, so maybe also check if youâve turned off the App Execution Alias for julia accidentally in your Windows settings.
I have added the very long path to a copy of julia.exe to my PATH environment variable.
I installed Julia by downloading julia.appinstaller - I have open a command line window which opens with a representation of the Julia icon in ASCII code, and to the right of this âDocumentation:â etc. I assume that this is what is called the shell. Below this there is a command prompt âjulia>â - from this I can enter a command directly, e.g. âprintln(âHelloâ)â and it replies âHelloâ. But I have found no way of running a script in Julia as a â.jlâ file in the sense that a Perl script might be contained in a file ending â.plâ or a Python script might be in a file ending â.pyâ. Is the shell not suitable for this?
Instead of just opening Julia via
(...)> julia
you can use
(...)> julia script.jl
(assuming that script.jl is in the current working directory, which is the (...) in front of the >). The first julia command opens the interactive REPL. The second only executes the script. See also Getting Started ¡ The Julia Language.
(If script.jl is not in the current working directory, you can cd to its folder, or provide the full (or relative) path to script.jl.)
This is all completely analogous to Pythonâs (...)> python script.py.
Alternatively, from within the Julia REPL you can use
julia> include("script.jl")
which runs the file in the current session. The script can then use whatever variables you have currently defined, and after it has run, all variables it created are available.
Consider getting the VS Code extension for Julia too: Getting Started ¡ Julia in VS Code
It too has a bit of learning curve (especially if youâre not familiar with VS Code already), but it gives you file editing, running, debugging, the REPL shell, plotting, etc., in the same UI, so you can explore and discover things easily in one tool.
One learning curve (guessing curve) is enough, thanks.
Are juliaup or julialauncher explained anywhere?
You can check the github page of juliaup.
If you are new to julia and want to do some scientific computation, I think this is not the main focus. Juliaup seems to be a relatively new construct. When I studied julia 3 years ago I just used the portable installer on Windows.
I think the workflow explained by eldee above is sufficient. And this link is relevant The Julia REPL ¡ The Julia Language.
I use julia on windows machines on a daily basis. Until recently I could not use juliaup directly but now it works.
In terms of environment variables, I only have <path_to_user_folder>\AppData\Local\Programs\Julia in my user PATH environment variable.
For a manual julia install it would be <path_to_user_folder>\AppData\Local\Programs\julia-x.y.z\bin.
This way I can use julia directly which maps to whatever the default channel is set to.
FYI I generally use Windows Terminal - Free download and install on Windows | Microsoft Store to call julia, I prefer it over the standard terminal for my use.
After juliaup has been installed, just call in Terminal
juliaup -h
While it is probably possible to configure your system to behave like that, it is not how the most people use Julia. Julia is not a scripting language in the sense Perl is, and trying to apply the Perl workflow to it is going to result in a lot of frustrations.
You may find Modern Julia Workflows helpful.