Error while installing vertx (vertx run server.js)

92 views
Skip to first unread message

Robin Talwar

unread,
Dec 12, 2013, 1:52:42 AM12/12/13
to ve...@googlegroups.com

I have Mac and i am installing Vertx version 2.0.2-final when i run vertx run server.js i get the following error :-

 org.mozilla.javascript.EvaluatorException: illegal character   
 (file:/Users/ICHI05/Documents/vertx/test/server.js#1) 

Following is the server.js :-

var vertx = require('vertx');

vertx.createHttpServer().requestHandler(function(req) {
req.response.end("Hello World!");
}).listen(8080, 'localhost');

Tim Yates

unread,
Dec 12, 2013, 4:27:11 AM12/12/13
to ve...@googlegroups.com
I have a mac too, and I get:

$ vertx version
2.0.2-final (built 2013-10-08 10:55:59) 

$ vertx run server.js 
Downloading io.vertx~lang-rhino~2.0.0-final. Please wait... 
Downloading 100%
Module io.vertx~lang-rhino~2.0.0-final successfully installed 

And then going to localhost:8080 shows Hello World as expected...

You might have a weird non-visible char in your server.js...  Can I suggest deleting server.js, copying it again from your own email, and trying that (as that's what I did and it works)

Cheers,

Tim

--
You received this message because you are subscribed to the Google Groups "vert.x" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vertx+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Robin Talwar

unread,
Dec 12, 2013, 4:33:27 AM12/12/13
to ve...@googlegroups.com
Hi Tim

Thanks for reply.
I did all the steps again and copied and replaced the server.js but still getting the same error.
Attached is my server.js , if you wanna test this 

Much appreciated
--
Regards
Abhishek Talwar
9953395712
server.js.zip

Tim Yates

unread,
Dec 12, 2013, 4:36:58 AM12/12/13
to ve...@googlegroups.com
I'm not surprised, this is what that server.js file contains:

{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf370
{\fonttbl\f0\fnil\fcharset0 Menlo-Regular;}
{\colortbl;\red255\green255\blue255;\red26\green26\blue26;\red234\green234\blue234;\red107\green0\blue3;
}
\margl1440\margr1440\vieww10800\viewh8400\viewkind0
\deftab720
\pard\pardeftab720\sl360

\f0\fs28 \cf2 \cb3 var vertx = require(\cf4 'vertx'\cf2 );\
\
vertx.createHttpServer().requestHandler(function(req) \{\
req.response.end(\cf4 "Hello World!"\cf2 );\
\}).listen(\cf4 8080\cf2 , \cf4 'localhost'\cf2 );\
}

Maybe paste the script without any formatting into something like SublimeText/TextMate?

I'm guessing you're using TextEdit and it's converting it to a styled RTF?

Tim

Norman Maurer

unread,
Dec 12, 2013, 4:37:47 AM12/12/13
to ve...@googlegroups.com, Robin Talwar
I just opened your file with vi and it shows up as:

{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf370
{\fonttbl\f0\fnil\fcharset0 Menlo-Regular;}
{\colortbl;\red255\green255\blue255;\red26\green26\blue26;\red234\green234\blue234;\red107\green0\blue3;
}
\margl1440\margr1440\vieww10800\viewh8400\viewkind0
\deftab720
\pard\pardeftab720\sl360

\f0\fs28 \cf2 \cb3 var vertx = require(\cf4 'vertx'\cf2 );\
\
vertx.createHttpServer().requestHandler(function(req) \{\
req.response.end(\cf4 "Hello World!"\cf2 );\
\}).listen(\cf4 8080\cf2 , \cf4 'localhost'\cf2 );\
}

So you copy and paste somehow corrupt it.
-- 
Norman Maurer

- server.js.zip, 648 bytes

Robin Talwar

unread,
Dec 12, 2013, 4:39:37 AM12/12/13
to Norman Maurer, ve...@googlegroups.com
ohh! my bad :) Got it working 

Tim Yates

unread,
Dec 12, 2013, 4:39:56 AM12/12/13
to ve...@googlegroups.com
Vi is a better cheaper suggestion ;-)

Tim Fox

unread,
Dec 12, 2013, 4:44:32 AM12/12/13
to ve...@googlegroups.com
Lesson for the day: Don't program using wordpad ;)

Robin Talwar

unread,
Dec 12, 2013, 4:47:26 AM12/12/13
to ve...@googlegroups.com
Any IDE you wanna recommend ?

Also since you have got an idea of my beginners skills in vertx i would appreciate if you could recommend some Ebooks ? tutorials ? Manuals ??

Tim Fox

unread,
Dec 12, 2013, 5:45:16 AM12/12/13
to ve...@googlegroups.com
Hi Robin,

I use IntelliJ IDEA for most things, Eclipse IDE is also good. Both are available free.

Some people prefer to use text editors and I use one sometimes (gedit on Linux). I'm not a Mac user so can't advise you on the best text editors for OSX.

Hope that helps.

Norman Maurer

unread,
Dec 12, 2013, 6:01:06 AM12/12/13
to ve...@googlegroups.com, Tim Fox
I use IntelliJ IDEA on OSX and also Sublime Text.

IntelliJ is free, Sublime Text is about 50 bucks if I remember right…

-- 
Norman Maurer

Jez P

unread,
Dec 12, 2013, 8:08:37 AM12/12/13
to ve...@googlegroups.com, Tim Fox, norman...@googlemail.com
+1 on both as being nice. I like Sublime more than TextMate/TextWrangler, but most of my coding is done in IDEA. As far as books go, the author of this is a regular contributor to this forum:-


so I'd say his work is worth a look, but I haven't actually read his books. I've generally found the vert.x documentation pretty good, as well as this forum.
Reply all
Reply to author
Forward
0 new messages