Some refactoring in startup method, removed Dir.chdir to be nicer to JRuby.