Renato Ferreira Renato Ferreira - 1 year ago 80
Linux Question

Cannot run julia file - syntax error close to the unexpected token

Well, i wrote a simple "hello world" in julia, but i cannot figure out on how to run the code. I've tried to run by

and the terminal returned to me that I have syntax errors.

My code is just:

println("hello world")

Wich works perfectly if i run
on the terminal and write the code after that...

The error is something like( I am translating it from portuguese):

./hello_world.jl: line 1:syntax error close to the unexpected token `"hello world"

./hello_world.jl: line 1: `println("hello world")'

I'm using vim, debian 8 and julia 0.3.2

Answer Source

Two ways I can think of to achieve what you want

Open a terminal and do either one of the following

Inside the julia relp, that is, if you run julia in the terminal by running


and when you're in, do


if you simple want to run the file, in the terminal do

julia nameoffile.jl
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download