Renato Ferreira Renato Ferreira - 9 months ago 22
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


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