Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

run server inside of netbean + java hotswapping

Custom Title Activated
Loyal Member
Joined
Nov 14, 2008
Messages
1,025
Reaction score
641
Although this is not really maplestory related, i think this will make people's life easier, especially those updating to a higher version.

Hotswapping is where whenever you save / make a change in a class, the class is automagically recompiled and swapped with the one in the currently running JVM. First you need to know how to run the server inside of Netbean

How to run the server inside of Netbean

1. right-click your project > properties > Run

2. enter your bat's parameter in the argument box. (Wz)
for example with me: -Dnet.sf.odinms.wzpath=wz

3. move your main folders inside your project folder (wz and scripts)

4. you can now run inside of netbean using this button

oxysoft - run server inside of netbean + java hotswapping - RaGEZONE Forums


You can also do memory profiling using netbean's profiler


How to use hotswapping

1. Tools > Options > Miscellaneous > Java Debugger > General
Check the box that says "Apply code changes ... blah blah"

2. Right project > Build > Compile
Check "Compile on save"

3. You must use this button if you want hotswapping to work

oxysoft - run server inside of netbean + java hotswapping - RaGEZONE Forums


Whenever you make changes and save, they will be applied. If you want to test just press the button as shown above (debug) and then add a println in login or something
 
Newbie Spellweaver
Joined
Jun 18, 2010
Messages
48
Reaction score
7
Apart of the testing process, what is the purpose of adding a println into login after debugging? As a check?
Also thank you very much OxySoft. I'm sure this will be very helpful.

OffTopic: I hope your server is going well. I put a app in only to disappear due to rl issues. lol
 
Newbie Spellweaver
Joined
Aug 7, 2012
Messages
5
Reaction score
4
hello oxy
thanks for your post
i copied the wz folder to the project folder and set the arguments to (-Dnet.sf.odinms.wzpath=wz)
but i still get an error as if it doesn't know where the wz folder


Loader 1...
Loader 2...
Loader 3...
Exception in thread "main" java.lang.ExceptionInInitializerError
at server.Start.run(Start.java:69)
at server.Start.main(Start.java:131)
Caused by: java.lang.NullPointerException
at provider.MapleDataProvider.fillMapleDataEntitys(MapleDataProvider.java:39)
at provider.MapleDataProvider.<init>(MapleDataProvider.java:35)
at provider.MapleDataProviderFactory.getWZ(MapleDataProviderFactory.java:31)
at provider.MapleDataProviderFactory.getDataProvider(MapleDataProviderFactory.java:37)
at server.life.MapleLifeFactory.<clinit>(MapleLifeFactory.java:45)
... 2 more
Java Result: 1
BUILD SUCCESSFUL (total time: 1 second)


EDIT: SOLVED, the project was using another source directory, not the one i copied to the project folder, as i forgot to update the source directory in netbeans
 
Last edited:

CEO

Newbie Spellweaver
Joined
Feb 8, 2012
Messages
87
Reaction score
16
hello oxy
thanks for your post
i copied the wz folder to the project folder and set the arguments to (-Dnet.sf.odinms.wzpath=wz)
but i still get an error as if it doesn't know where the wz folder
Me too.

Any ideas ?
 
Initiate Mage
Joined
Oct 3, 2012
Messages
1
Reaction score
0
Wont work, I followed steps.
run:
[Lithium] Revision: -1
Loading MapleGuildRanking
Loading MapleFamily
Loading MapleLifeFactory
Exception in thread "main" java.lang.ExceptionInInitializerError
at server.Start.run(Start.java:65)
at server.Start.main(Start.java:126)
Caused by: java.lang.NullPointerException
at provider.MapleDataProvider.fillMapleDataEntitys(MapleDataProvider.java:39)
at provider.MapleDataProvider.<init>(MapleDataProvider.java:35)
at provider.MapleDataProviderFactory.getWZ(MapleDataProviderFactory.java:31)
at provider.MapleDataProviderFactory.getDataProvider(MapleDataProviderFactory.java:37)
at server.life.MapleLifeFactory.<clinit>(MapleLifeFactory.java:46)
... 2 more
Java Result: 1
BUILD SUCCESSFUL (total time: 0 seconds)
 
Joined
Sep 2, 2010
Messages
393
Reaction score
10
Is this used for being in-game and editing in Netbeans and it takes effect immediately, instead of making changes compile and repeat the cycle? If so could you re-update this guide or upload the pictures? They seem to be gone.
 
Custom Title Activated
Loyal Member
Joined
Nov 14, 2008
Messages
1,025
Reaction score
641
Is this used for being in-game and editing in Netbeans and it takes effect immediately, instead of making changes compile and repeat the cycle?

That's exactly what it is.

The first image was like just a play button and the second one was the debug button. I do encourage everybody here to use Eclipse instead of the slow and ugly IDE that is Netbean.
 
Elite Diviner
Joined
Aug 29, 2011
Messages
404
Reaction score
8
That's exactly what it is.

The first image was like just a play button and the second one was the debug button. I do encourage everybody here to use Eclipse instead of the slow and ugly IDE that is Netbean.
I don't mean to necro-post Oxy, but how would this work on a v83 server? Insanely confusing trying to get this to work on v83...
 
Custom Title Activated
Loyal Member
Joined
Nov 14, 2008
Messages
1,025
Reaction score
641
I don't mean to necro-post Oxy, but how would this work on a v83 server? Insanely confusing trying to get this to work on v83...

There is nothing wrong with necro posting in a thread such as this. If a moderator deems it unfit, I'll personally give them my middle finger. I may update the thread later this week if I have time, but you'll need to figure it out yourself for now.

It's just creating a project in eclipse and running it with this button up there

IMVWOG7 - run server inside of netbean + java hotswapping - RaGEZONE Forums
 

Attachments

You must be registered for see attachments list
Elite Diviner
Joined
Aug 29, 2011
Messages
404
Reaction score
8
There is nothing wrong with necro posting in a thread such as this. If a moderator deems it unfit, I'll personally give them my middle finger. I may update the thread later this week if I have time, but you'll need to figure it out yourself for now.

It's just creating a project in eclipse and running it with this button up there

IMVWOG7 - run server inside of netbean + java hotswapping - RaGEZONE Forums
I just started using eclipse and it's a little weird but no problem for the most part. It's hard on v83 because there are like 3 launchers and whereas in v117 it's 1 launcher and has like 1 wz path. I'll keep trying and hopefully get it working on v83.
 

Attachments

You must be registered for see attachments list
Skilled Illusionist
Joined
Aug 16, 2010
Messages
346
Reaction score
109
I just started using eclipse and it's a little weird but no problem for the most part. It's hard on v83 because there are like 3 launchers and whereas in v117 it's 1 launcher and has like 1 wz path. I'll keep trying and hopefully get it working on v83.

Couldn't you make a new Start.java, and have it run all the 3 launchers successively in different threads?
 
Elite Diviner
Joined
Aug 29, 2011
Messages
404
Reaction score
8
Couldn't you make a new Start.java, and have it run all the 3 launchers successively in different threads?
How would that be possible though? In ChannelServer it's just "run() {" when I try to call it I can't.. I took a look at how v117 and still couldn't do it.

I got something like this:
PHP:
package server;

import java.util.concurrent.atomic.AtomicInteger;
import net.channel.ChannelServer;
import net.login.LoginServer;

public class Start {

    public static long startTime = System.currentTimeMillis();
    public static final Start instance = new Start();
    public static AtomicInteger CompletedLoadingThreads = new AtomicInteger(0);
    private byte channel;

    public void run() throws InterruptedException {
        ChannelServer.getInstance(channel).run();
        LoginServer.getInstance().run();
    }
}
 
Last edited:
Skilled Illusionist
Joined
Aug 16, 2010
Messages
346
Reaction score
109
Is it called with certain parameters that you need to input?

And it should be the main() sub that's called if I'm not wrong
 
Elite Diviner
Joined
Aug 29, 2011
Messages
404
Reaction score
8
Is it called with certain parameters that you need to input?

And it should be the main() sub that's called if I'm not wrong
I tried it your way but it still didn't pop up as a main class.
PHP:
package server;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.rmi.NotBoundException;
import java.util.concurrent.atomic.AtomicInteger;
import javax.management.InstanceAlreadyExistsException;
import javax.management.MalformedObjectNameException;
import net.channel.ChannelServer;
import net.login.LoginServer;
import net.world.WorldServer;

public class Start {

    public static long startTime = System.currentTimeMillis();
    public static final Start instance = new Start();
    public static AtomicInteger CompletedLoadingThreads = new AtomicInteger(0);
    public int channel;
    public String args[];

    public void run() throws InterruptedException, FileNotFoundException, IOException, NotBoundException, InstanceAlreadyExistsException, MalformedObjectNameException {
        System.setProperty("net.sf.odinms.wzpath", "wz");
        ChannelServer.main(args);
        ChannelServer.getInstance(channel).run();
        LoginServer.main(args);
        LoginServer.getInstance().run();
        WorldServer.main(args);
    }
}
 
Elite Diviner
Joined
Aug 29, 2011
Messages
404
Reaction score
8
It should pop up within the same output window.
It didn't O.O. I have no idea what i'm doing wrong. The only classes that popup in the output window are "net.ChannelServer", "net.LoginServer", "net.WorldServer" the regular classes. As well as tools.MonsterDropCreator.

It should pop up within the same output window.
It still doesn't pop up in the output window as a main class. This is the cleanest and farthest I have gotten.

PHP:
package tools;

import java.rmi.registry.LocateRegistry;
import javax.rmi.ssl.SslRMIClientSocketFactory;
import javax.rmi.ssl.SslRMIServerSocketFactory;
import net.ServerMode;
import net.world.WorldRegistryImpl;

public class Start {

    public static void main(String[] args) {
        ServerMode.setServerMode(ServerMode.Mode.WORLD);
        ServerMode.setServerMode(ServerMode.Mode.LOGIN);
        ServerMode.setServerMode(ServerMode.Mode.CHANNEL);
        try {
            LocateRegistry.createRegistry(1100, new SslRMIClientSocketFactory(), new SslRMIServerSocketFactory()).rebind("WorldRegistry", WorldRegistryImpl.getInstance());
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }
}

The output window only popped up after I added main(string[] args) {.

If anyone can help me solve this I would appreciate it.

Any ideas on how to make this work on v83?
 
Last edited by a moderator:
Custom Title Activated
Loyal Member
Joined
Nov 14, 2008
Messages
1,025
Reaction score
641
I just started using eclipse and it's a little weird but no problem for the most part. It's hard on v83 because there are like 3 launchers and whereas in v117 it's 1 launcher and has like 1 wz path. I'll keep trying and hopefully get it working on v83.

I don't think you can run your server in netbean or eclipse if your source uses RMI. (Unless you run all three instances one after the other which could be an annoyance) Eclipse is greatly superior to Netbean in my opinion. It's more lightweight and I feel like it is more responsive when I type code in it. (Less delay when I type) It's just a more pleasant experience all-around
 
Back
Top