Setup Eclipse and SVN

How to get L2J Server with Eclipse
Download Eclipse

Optimise Eclipse to run faster

Install the Eclipse SVN plugin

Download L2J server

Compile L2J server

Download
First of all you must download Eclipse from here: Eclipse download site

The one you're looking for is either Eclipse Classic or Eclipse IDE for JAVA Developers, preferably the latest version.

Download your prefered build and extract it anywhere (but don't be a computer noob and don't put it on desktop. C:\Eclipse or /home/username/Eclipse will work just fine).

Optimisation
Go to the Eclipse folder and open eclipse.ini (use an advanced text editor like Notepad++ if you're on Windows; by default the file has Unix line breaks and Notepad doesn't recognise them).

Find the line that says -vmargs and replace it with the following:

-vm C:\Program Files\Java\jdkX.X.X_XX\jre\bin\client\jvm.dll # edit this accordingly and remove this comment afterwards -vmargs -Dosgi.requiredJavaVersion=1.7 -Xms512M -Xmx512M -Xss4M -XX:PermSize=128M -XX:MaxPermSize=256M -XX:MaxGCPauseMillis=10 -XX:MaxHeapFreeRatio=70 -XX:+UnlockExperimentalVMOptions -XX:UseG1GC -XX:+UseFastAccessorMethods -Dcom.sun.management.jmxremote -Xverify:none

These are some nice JVM tweaks to make your Eclipse run faster.

''Eclipse developers recommend using the -vm argument, but you can also set up the JAVA_HOME environment variable on your system. This will enable all other programs (including L2J server) to find your installation of JDK. If you're on Windows 7, you can follow this guide, or find one that suits your operating system using your favourite search engine.''

''In case you have very low memory on your computer (less than 2 GB), you might want to decrease the value of the -Xms and -Xmx variables. It should be around 1/4th of your RAM, unless you have lots of it.''

When that is done, save and close the file.

SVN Setup
Now run Eclipse itself (on Windows its eclipse.exe; you might want to put a shortcut of it on the desktop).

When it loads up (this might take from a few seconds to even a minute or more, depending on the version of Eclipse and your computer specs), close the Welcome screen (X on the tab at the top) and go to Help > Install new software...



In the window that pops up, choose the update site that is named after your version of Eclipse.



When you select it, a list of options should appear below the dropdown (might take a few seconds since it downloads that list). Expand Collaboration, find Subversive SVN Team Provider (or just filter it out by typing svn in the search bar at the top).



Check it, and just follow a typical install sequence (next, next, I accept, finish).

''You only need the Team Provider plugin, not the sources, localization or optionals, but the JDT Ignore Extensions won't harm if you check it too. It just makes Eclipse ignore some output folders.''

''If you can't find Subversive SVN Team Provider, it is possible that you already have it installed. To make sure, uncheck the Hide items that are already installed checkbox at the bottom. Eclipse will reload the plugin list, but this time it will also show the already installed plugins (they have white icon color, while the installed ones have the yellow-ish background). If you still can't find the plugin, you can ask for help in either L2J forums or the Eclipse community board.''

It will now download the Subversive plugin and afterwards ask you to restart Eclipse (which you should do).

If you are using Eclipse 3.7, you must now do one more thing:

go to Window > Preferences, open Install/Update > Available Software Sites, find the Subversive update site in the list that is shown (there's a search bar at the top, just type in "subversive"), and enable any that pop up (button on the right side of the window).



''This will enable Eclipse to update the Subversive plugin to support SVN 1.7, which L2J uses for its projects. Eclipse 4.2 automatically enables its own update site, so if you're using 4.2, you're already fine.''

Back to all Eclipse versions

Now go to Help > Check for updates to update the Subversive plugin and any other plugins, and let it do its thing. As always, it will ask you to restart Eclipse when the process is done.

''Either after this restart or when you first try to connect to an SVN repository, Eclipse will pop up a window asking you to select an SVN connector. Depending on your OS and its architecture, choose either Native JavaHL (Windows, 32bit only) or SVNKit (64bit Windows and other operating systems) (if you've updated your plugins, it should offer at least version 1.7.4), and install it (this will probably require another restart).''



When everything is set up, go to Window > Show View > Other.... In the window that pops up, find and expand SVN, select SVN Repositories and click OK.



You might want to move the View that opens around a bit so that it doesn't hide the Project Explorer View right below it.

'''Also, current L2J's build file requires you to have a Subversion client installed. Most popular ones are SlikSVN (Console only. Contains svnadmin, which allows you to create your own local SVN repositories), CollabNet Subversion (does not contain svnadmin) and TortoiseSVN (Windows only, but also includes a stand-alone GUI for working with repositories).

After installing the SVN client, you might need to add its folder of binaries to your PATH variable. SlikSVN has an option to do this automatically during installation, others probably have it too. To check if the SVN client was added to PATH, you can open your command prompt/bash shell and type in svn and click Enter. If it does not recognise the command, then it was not added to your PATH and you must do it manually. A guide for Windows is available here (and a lot more detailed info can be found here). The location you must add should be similar to this: C:\Program Files\SlikSVN\bin.'''

''Up to this point, all of this has nothing to do with L2J, so the info can be used by anyone interested in setting up Eclipse and SVN to work with it. The next part, however, is project-specific.''

Download L2J server
Now right-click in the blank space in the SVN Repositories View and choose New > Repository Location...



In the URL field of the popup, you should now enter the SVN address of the L2J server code repository. There are two repositories you should checkout that are required for a full server; one is for core code (the brains of the server), the other is for datapack (htmls, quests, item and skill data etc.).

If you're looking for a version of L2J server for an older chronicle than the one currently on NA/EU official servers, check this thread for SVN links.

But if you're looking for the latest code, use either the somewhat stable trunk:

core: http://svn.l2jserver.com/trunk/L2J_Server/ datapack: http://svn.l2jdp.com/trunk/L2J_DataPack/ or the absolute latest code from the unstable branch:

core: http://svn.l2jserver.com/branches/unstable/L2J_Server_BETA/ datapack: http://svn.l2jdp.com/branches/unstable/L2J_DataPack_BETA/

When you've chosen the right repositories for you, copy/paste both of them into the URL field and click Finish.



After that, right-click the repositories and click Check Out (first core, then datapack).



''The core repository will download pretty fast, but the datapack might take a long time, even up to half an hour or more, because it has many thousands of small files. So be patient at this step.''

When a repository has downloaded, Eclipse adds the downloaded code as a project in your workspace (both projects have now appeared in the Project Explorer View at the left side of the main Eclipse window).

This is the code that you should edit; it will make it easier to keep your changes when updating the code (see this guide on how to keep your code updated and keep your changes intact most of the time).

Compile L2J server
You can compile/zip both projects by right-clicking a file named build.xml located in the main folder of each project, and choosing Run as... > Ant build.



The resulting archives will be located in the build folder and will be named after the projects (L2J_Server_BETA.zip etc.). Those are called project builds and that's what you use to run your own server.

When you've arrived at this point, the next step is to read the L2J server setup guide for Windows or  for Linux; it is where you'll learn to set up and run the server to play on it.

For more questions feel free to visit our forum or join us on IRC.