"Smartfoxserver2x Setup in Eclipse"

Writing SmartFoxServer2x Extension Program in Eclipse (step by step)

Follows These steps To Create/Configure New Zone

Step 1:- Open Eclipse and create a New Java ProjectSmartfoxServer2X Admin Panel SmartfoxServer2X Admin Panel

Step 2:- Name The Java Project I assumed it as "MySFSPorject" SmartfoxServer2X Admin Panel

Step 3:- Create a library folder named "lib" to place SmartfoxServer2x library files to create SmartfoxExtension.SmartfoxServer2X Admin Panel

Step 4:- In order to create a SmartFoxServer2X Extension program we need the following jar files, those are available in SFS2x-<lib folder select those

  1. sfs2x.jar
  2. sfs2x-core.jar
  3. log4j-x.jar
  4. slf4j-api.x.jar
  5. slf4j-log.x.jar

Copy the above jars and paste it into lib folder created in the earlier step. SmartfoxServer2X Admin Panel SmartfoxServer2X Admin Panel

Step 5:- Add the above pasted jars to java build path as
Select project -< rightclick and select “properties”-<select ‘javabuildpath’ - < Select ‘Libraries’ Tab -< Click ‘Add Jars’ -< select the above 5 jars pasted in your ‘lib’ folder -< press ok button. SmartfoxServer2X Admin Panel

Step 6:- Create a new ‘Class’ named MySFSExtension under package 'com.tutorialtous.smartfox' as a child class of SFSExtension.
New-< java class SmartfoxServer2X Admin Panel

Step 7:- Now Write the following code in MySFSExtension.java file SmartfoxServer2X Admin Panel

package com.tutorialtous.smartfox;
import com.smartfoxserver.v2.extensions.SFSExtension;
public class MySFSExtension extends SFSExtension {
  public void init() {
    trace("MySFSExtension Init method fired");
  private void initClientRequestHandlers() {
  private void initEventHandlers() {
  public void destroy() {
    trace("MySFSExtension destroy fired while Smartfox is going down");

Step 8:- Create a Folder under extensions folder (SFS2X-<extensions), I am creating a folder name MyExtension (SFS2X-<extensions->MyExtension).SmartfoxServer2X Admin Panel

Step 9:- Now Create a Jar file using Exports option of eclipse by selecting the current project src. Means

  • Select src folder project
  • Right click , choose EXPORT option and select JAR option.
  • Now Browse button and select the extension folder created in last step
  • Name the jar and press ok
  • SmartfoxServer2X Admin Panel
  • SmartfoxServer2X Admin Panel
  • SmartfoxServer2X Admin Panel

Step 10:- Configure/Create the zone (I created a zone named ‘CasinoGameServer’ under zones folder)
Main Part to configure is


Step 11:- :- Restart the SmartfoxServer using batch file sfs2x.bat located in SFS2x folder SFS2x-<sfs2x.bat.
Now you will see a zone name echo with the trace of init() method in the console as SmartfoxServer2X Admin Panel

Copyright © 2018-2020 TutorialToUs. All rights reserved.