!!

Register new account or login on the forum!

To have a full access of the forum please create a new account! Click here or login with your account Click here.

Main Plaza > Guides

Development workflow (hot deploy)

(1/1)

ruke:
Note: I wrote this guide for l2jserver, but it should work the same for Frozen. Let me know if you run into issues.

Hi, I just recently started working on L2J and while I was implementing a few custom features in the server I found the development workflow quite awful since I had to make quite a lot of steps to actually see my changes: change the code -> compile -> update files -> shutdown server -> start server -> login again -> see the changes in game.

So, I wanted a change, I only wanted to follow these steps: change code -> compile -> see changes in game. And luckily I was able to accomplish it.

What do you need?
- A working server
- The sources of the l2jserver/frozen (obviously)

Steps

1 - In your source folder, you need the gameserver/config and gameserver/data folders from YOUR WORKING SERVER. You can do this by copying the folders or create a symbolic link so any changes you made to those folders are reflected without having to copy/paste again.



2 - Download DCEVM (light) for Java 8u144 (build 2)

3 - Download HotswapAgent

4 - Download JDK 8u144

5 - Install JDK 8

6 - Open a command line with administrator permissions:



7 - In your command line, go to the folder where you downloaded DCEVM (light) for Java 8u144 (build 2) and run it:


--- Code: ---$ cd path/to/your/DCEVM (light) for Java 8u144 (build 2)
$ java -jar DCEVM-8u144-installer.jar
--- End code ---

8 - Once the application opens, select your JDK 8 and click Install DCEVM as altjvm:



Perfect, almost done!

9 - Open your IDE, and go to the Run configurations



10 - Complete with the following:

Name: GameServer Hotswap

Main class: net.sf.l2j.gameserver.GameServer (if you cannot find it, try searching for gameServer.GamesServer)

VM Options: -XXaltjvm=dcevm -javaagent:PATH\TO\hotswap-agent.jar

JRE: Make sure you have selected JDK 1.8.0.144



11 - Go to your gameServer.GameServer class, and make sure the logs line are commented:



12 - Start your loginServer as usual.

13 - Go to your IDE, and run GameServer Hotswap (from step 10)

14 - Your server should be up, try login with a character.

15 - If you succeed, perfect, now the exciting part, let's make a tiny change. Go to java/net/sf/l2j/gameserver/clientpackets/EnterWorld.java class and add this line to runImpl method, in the line 108:


--- Code: ---activeChar.sendMessage("Hello from HOTDEPLOY!");
--- End code ---

16 - Save the file, and rebuild the project:



You should have a message that a class was updated.
Great, our change is already on, go to your server, login with a character and:



Did you notice? no downtime!

Hope it helps. Happy to help if anyone cannot do it.

Have a good day.

ReynalDev:
Wow!! Nice guide but this only work when you are in development because in a real server (Production) doesn't have any sense install all those programs.  ;D

ruke:
Right, this is only for development ^^

ReynalDev:

--- Quote from: ruke on October 25, 2017, 12:54:36 AM ---Right, this is only for development ^^

--- End quote ---

Thanks for share!  ;)

Nefer:
Nice work, i always accept guide from our community.  ;)

Navigation

[0] Message Index

Go to full version