How to link .jl files with Julia 0.7 or 1.0 on windows 7

Hi !

I am Linux user and I plan to distribute a Julia software. So, unfortunately, I have to deal with windows and to make an installation tutorial.
When I install Julia 0.7 on win7 64bits, the .jl files are not linked with Julia-0.7.0/bin/julia.

When I try to do this association manually using the “open with” form, I select the C:\User\Fred\AppData\local\Julia-0.7.0\bin\julia but the Julia software does not appear in the form. And no link seems possible.

So, in Windows, it is very easy to use REPL interactively after Julia installation. But non interactive use of Julia seems to be really very difficult. If I click on a .jl file, Julia does not start. If I type “julia” on the command prompt, I see that Julia is not in the PATH.

I would like to start my software with a simple click because my users are not programmers. If I just “slide” my .jl file on the Julia shortcut, the software start but then execution is not possible because it does not execute in the software directory where some files are necessary…

Thank you for your help !

I have tried this and it works exactly as you describe and as it is expected (tried on Win7 64bit and Win10 64bit).
So only difference here is, that the julia.exe is in c:\Program Files\Julia-0.7.0-DEV\bin\ but I am pretty sure that it should work with any path to the julia.exe.

My guess is that it is something on your Windows machine, maybe some group policy (your admins not allowing this kind of action). You could try to do the same with another file type and another .exe, to see if this is the case.

@oheil thank you very much for your answer !

I uninstall Julia. Then I started again the installer.exe (right click install as administrator) and I installed Julia in c:\Program Files\Julia-0.7.0

Then I click on a .jl file , tried to associate jl file with c:\Program Files\Julia-0.7.0\bin\julia and I failed again :frowning: So I suppose something is wrong with my windows (I use a virtualbox image of window on Linux to make a video tutorial)…

Maybe this:

Shouldn’t make any difference if virtual or not.

@oheil Thank you again !

I will try… but I cannot show that on a video tutorial :smiley:

To register the exe correctly it may be sufficient to install julia with admin rights.
I think thats what I have done in the past, when I installed julia to have it in C.\Programs…

Yes, I understand that part :slight_smile:
At least for my Windows 10 machine the setup is more like yours: installed without admin rights directly into my AppData path, no issues, associating .jl to the exe there works.

You can simply do something along the following (in the command prompt)
C:\Julia-0.7.X\bin\julia.exe "c:\\temp\\myscript.jl"

this should run mysript.jl

I would suggest to put julia.exe in your PATH though.
I am personally not a fan of double-clicking and executing a script. To the best of my knowledge this is commonly not done (e.g. by Windows users of Julia/R/Matlab/… ).

If you cannot associate it, a *.bat file (batch file) would do the trick by including something along the code above. Google should help you on this topic too (also how you can set the working directory prior to invoking julia.exe)

@bernhard, I completely agree with you. I decided to stop using windows 20 years ago and use GNU Linux instead. This is by far my best my best decision in computer science. But I have made a tool for biologists and there is no-way they type command lines :slight_smile:

When I have to share a software with windows users, if possible, I do it in Golang because cross compilation is so easy. But this time, I need large dataframes and Julia was easier than Go :wink:

The idea of a .bat file is great, but, to use it, I think that I must know exactly where the user will install Julia…

When I try to do this association manually using the “open with” form, I select the C:\User\Fred\AppData\local\Julia-0.7.0\bin\julia but the Julia software does not appear in the form. And no link seems possible.

There is no open with / choose default program, where you can then put in the path to the julia binary? I just tried it (Win 7), and this works fine for me, I tested with:

println("hi")
@show pwd()
sleep(3)

Which then opens up a prompt which shows:

hi
pwd() = "c:\\tmp\\runjl"

For 3 seconds and then the window closes automatically. I assume this is what you want?
I would also recommend putting julia in the path and showing them how to work the REPL though.

Yes there is :slight_smile: and I know how to use it because in the past I succeeded (I do not remember with which version of Julia it was around 5.0) but this time, with Julia 0.6 or 0.7 it refuses to do it ! :smiley:

Since many of you managed easily to do the association of *.jl with Julia, I think that I have a problem in my windows install :roll_eyes:

Aww c’mon… We’re not that bad. Most biologists can at least copy-paste into the command line, even if it make our palms sweaty.

regarding open with:
you should be able to
shift right click on any file with “.jl” ending, open with, chose another app, more apps, look for another app on this pc

this should bring you to an exporer-ish window where you can select any executable.

You are saying julia.exe exists, but is not visible in that window?
Can you give us a screenshot?
I can confirm what visr said above, it is working (notably I am a windows user; you seem to have misunderstood me :slight_smile: )

Of course they are not that bad ! But most of them are so afraid by terminals that they even do not want to give a try ! :smile:

@bernhard, I have made a video here :

I think that my windows as a problem :stuck_out_tongue_closed_eyes:

Indeed that is a strange issue. It seems your VM uses Windows7. I do not have any such machine handy.
I am not sure how to fix that… (google might be helpful though). I would expect that this is not julia related.

The source of the issue is unclear, because, in the past with old Julia version, I remember to have succeeded. Since I used this win7 VM to test many Julia versions, it is possible that when I un-install Julia to upgrade, something useful is removed or it is because I have a French version of windows…

I was able to reproduce what you are experiencing by playing around with the registry mentioned in the microsoft support article above.

I guess you don’t have write access to the registry key
HKEY_CLASSES_ROOT\Applications

Open the registry editor
regedit.exe

Navigate to
HKEY_CLASSES_ROOT\Applications

Right Click in the left pane on “Applications” and choose “permissions” (your french pendant).

You or “Users” should have “Full access” to it, if not, change it so that you can write and edit this key and everything beneath.

If I remove the write access on my computer I have exactly the same behaviour. If I also remove read access I don’t see any application to associate with.

@oheil thank you very much for taking the time to answer. The user already add the “Full access” right in HKEY_CLASSES_ROOT\Applications.

But, interestingly, I found a julia.exe key pointing to AppData\local\Julia-0.6.3\bin\julia.exe !
So it seems that the uninstall program of julia 6.3 did not fully uninstall the software, and maybe, the install software of Julia 1.0 cannot overwrite the old key…

Yes, something like that.

It did no harm deleting the julia key in the tree. After going the association task (browsing to julia.exe and so on) the key was newly created and then it appeared in the list of applications to associate with. It did not appear and the julia key was not created if I removed the rights for this. ie. setting to read only.

1 Like