zoukankan      html  css  js  c++  java
  • Installing And Running Project Darkstar

    转自:http://www.acyborgreality.com/?p=192

    Project Darkstar?! That sounds incredibly epic and awesome. Personally I think it is both of those things and I haven’t even gotten that in depth with it. Project Darkstar is being made by the incredible folks at Sun to make developing massive multi player applications (read massive multiple games!! ) on Java easier.

    Which, it needs to be easier. Messing around with the basic NIO classes was like wrapping my head around how women work. It just wasn’t happening. A book might have helped; but instead there is now Project Darkstar! As with anything new there isn’t a ton of documentation on it so installing and getting it to run is MUCH more difficult than it should be; which is why I’ve decided to highlight the installation process that I have. This is both for myself and for others; currently my setup is not perfect and I’m still learning but I’ll update as I learn/fix things. I’m running Windows Vista and no big IDE. I’m just using Notepad++ - if you’re on a different OS things might be a little different. If you’re using a big IDE like Eclipse then this won’t help you too much.

    1. Download the server

    Go to http://www.projectdarkstar.com and click on the download button. Download the Project Darkstar Server, source & binary. It’s about 10MB as of writing this. You’ll get a file that is something like: sgs-server-dist-0.9.9.zip. I extracted zip to my C:\Barracks directory and renamed the folder sgs-server-dist-0.9.9 to just sg-server. So now when I go to C:/Barracks/sgs-server I see the lib, conf, bin, ect folders.

    2. Run an already compiled jar

    The server comes with a tutorial jar ( tutorial.jar ) I ended up extracting it to see all the pretty files inside. In here there is a tutorial file; ServerAppTutorial.pdf. I recommend opening it up because there is useful information in there. This section is explained in the tutorial but the next section of my little guide is not. To run one of the jars that came with the server

    1. Open a command prompt and go to your sgs-server home. For me this is C:/Barracks/sgs-server.

    2. The command for running the HelloWorld example is: java -jar bin/sgs-boot.jar tutorial/conf/HelloWorld.boot

    3. To stop the server open another command prompt, go to your sgs-server home, and type in the following command: java -jar bin/sgs-stop.jar tutorial/conf/HelloWorld.boot

    Now wasn’t that easy? Yes it was very easy. There is code in the tutorial pdf provided that shows what’s going on behind the scenes. For now that’s way more information than we need. We still have some more steps to go before we even think about what’s going on behind the scenes.

    3. Run your own jar

    Now as of writing this I don’t even have this perfected but after spending way too much time messing around with stuff I have gotten what I believe is a solution that works well enough for me to deal with any issues later. We’re just going to try and run the HelloWorld code - nothing complex for our first try.

    1. I created a directory in my sgs-server home directory called HelloWorld, since I figured it would be easy to launch files from in there. It’s C:/Barracks/sgs-server/HelloWorld

    2. Create a blank HelloWorld.java file and then copy and pasted the HelloWorld code that is in the tutorial. 

    3. Delete the line: package com.sun.sgs.tutorial.server.lesson1;

    4. Create a HelloWorld.boot file with the following information:

    SGS_DEPLOY=${SGS_HOME}/HelloWorld

    SGS_PROPERTIES=${SGS_HOME}/HelloWorld/HelloWorld.properties

    SGS_LOGGING=${SGS_HOME}/HelloWorld/logging.properties

    5. Create a HelloWorld.properties file with the following information:

    com.sun.sgs.app.name=HelloWorld

    com.sun.sgs.app.root=HelloWorld

    com.sun.sgs.impl.transport.tcp.listen.port=1139

    com.sun.sgs.app.listener=HelloWorld

    6. Compile your .java file into a .class file. To do this go to your HelloWorld directory C:/Barracks/sgs-server/HelloWorld. Enter in the command: javac -cp C:\Barracks\sgs-server\lib\sgs-server-0.9.9.jar HelloWorld.java. This should compile. I added the server to my classpath but that didn’t seem to do anything ( how odd ) so I just include it in the javac statement.

    7. Turn your .class file into a jar with the following command: jar -cf HelloWorld.jar HelloWorld.class

    8. Now that you have a jar we’ll use the same command previously used but changing where to look for everything. java -jar bin/sgs-boot.jar HelloWorld/HelloWorld.boot

    9. Stop the server: java -jar bin/sgs-stop.jar HelloWorld/HelloWorld.boot

    Now that was a little more complicated but overall that really wasn’t that bad either! It’s amazing how long it took me to figure out this fairly simple process. Next time - information about actually coding using Project Darkstar! Keep in mind that if I figure out a better way of doing things this post will be updated with the new information!

  • 相关阅读:
    Linux开机启动详解
    git配置多用户多平台
    CentOS7 启动docker.service失败(code=exited, status=1/FAILURE)
    Linux 利用lsof命令恢复删除的文件
    56.storm 之 hello world (集群模式)
    55.storm 之 hello word(本地模式)
    54.Storm环境搭建
    53.storm简介
    深入浅出Mybatis-分页
    storm:最火的流式处理框架
  • 原文地址:https://www.cnblogs.com/sevenyuan/p/1610572.html
Copyright © 2011-2022 走看看