Tutorial for Building Liliths Throne
You will need the Eclipse IDE and Java SE Development Kit!
If you already have Eclipse, verify that you are running Luna or later, as Java 1.8 is required
- Open Eclipse
- Click File, Import it will then open a wizard, open Git and choose Projects from Git, click Next
- Choose Clone URL and then click Next
- Put https://github.com/Innoxia/liliths-throne-public (or https://github.com/Innoxia/liliths-throne-public/tree/dev if you're building from the dev branch) into the first box in Location
- Put github.com into the second box in Location, this may be done automatically.
- Put /Innoxia/liliths-throne-public (or /Innoxia/liliths-throne-public/tree/dev for dev branch) in the third box in Location, this may be done automatically. Then click Next
- The wizard will now ask which branch you want, this will be "master" (or "dev" for dev branch), select this and then click next.
- Unless you want to change the directory, click Next.
- It will now download the repository.
- Make sure "Import existing Eclipse projects" is selected, then click Next.
- Make sure the Lilith's Throne project is selected, then click Finish.
- Click File, and then select Export.
- Open Java, and then choose "Runnable JAR File"
- Choose Main - LilithsThrone under Launch Configuration (IF THERE ARE NO OPTIONS, READ HELP BELOW)
- Choose an export destination for the .jar file, this should be where you normally run the game from
- Click Finish, A warning may pop up saying "JAR export finished with warnings" This is fine.
- You should now be able to run the exported .jar file!
If the jar does not run:
- Check menu:File->Properties->left pane:Java Build Path->tab:Libraries
- If this does not list a jdk 1.8 system library, download the jdk from the above oracle link
- Extract it and follow instructions in eclipse menu:help->Search->type:'Adding a new JRE definition'
- Possibly you may have to menu:Source->Clean Up, then try again steps 12-17.
No Launch Configuration OR "Could not find main method from given launch configuration."
- First close the Export wizard, and click on the icon in the top of the left pane.
- Select the Project in the Package Explorer
- In the top bar, click Project, and then Properties
- In the left column, select Run/Debug Settings
- In the right column, click New
- Choose Java Application, and click OK
- A Wizard will open, click Search next to the "Main Class" Box
- Another Window will open, there will be one matching item called "Main - com.lilithsthrone.main" Select this and click OK
- Click OK
- Click Apply and Close
- Try Exporting Again
"C:\Users[USERNAME]\git\liliths-throne-public is not an empty directory."
This is the same error as "Some or all projects cannot be imported as they already exist in the workspace"
This is most likely because you have already have an outdated build open as a project. Make note of the directory it is reporting as not being empty.
- Close the import wizard
- In the Package Explorer, right click the project, and click Delete
- Make sure you select "Delete Project Contents on Disk". If you don't do this, you will have to do it manually in Windows File Explorer.
- Try Importing again
Eclipse stuck on importing from Git
The GIT plugin of Eclipse tries to run the "bash" command, and if you hadn't installed Windows Subsystem for Linux properly, it may cause problems with import.
- In "Turn Windows features on or off", check if Windows Subsystem for Linux is activated.
- If it's active, try to execute "bash" in Command Prompt.
- If result contains the phrase "Windows Subsystem for Linux has no installed distributions", then you have to install Linux distribution. Fortunately, the basic setup can be done with just one command.
- Run "lxrun /install" in Command Prompt, type "y" to continue, after that - enter some username and password.
- Run "bash" in Command Prompt once. If the appearance of the console changes, then you've succeeded.
- Try Importing once again.
Maven is a Java build system that can be used to build applications.
Support is integrated into Eclipse, but it can be used without an IDE, so you can build the game without Eclipse.
All build information is provided in pom.xml.
From the root of the repository (the folder where
pom.xml is) run:
This creates the JAR file in
Your first build will take longer than the subsequent ones as only changed files are recompiled.
You should be able to use NetBeans' import zip feature to easily import this project.
- Use the green "Clone or Download" button on the project's main page, and choose "Download ZIP".
- In NetBeans, navigate to: "File -> Import Project -> From Zip..."
- Select the ZIP download from step 1.
- The imported project should now run in NetBeans.
Using IntelliJ IDEA
You can use IDEA to clone the repository directly:
- Import the project from Git with "File" > "New" > "Project from Version Control" > "Git"
- The "Git Repository URL" is https://github.com/Innoxia/liliths-throne-public, verify it by clicking the "Test" button.
- "Parent Directory" and "Directory Name" define where to store the project locally, so pick the location you prefer.
- Click "Clone" to start importing the project.
- After a moment, you should see a popup in the bottom right corner informing you that there is an unmanaged pom.xml. Click the popup and select "Add as Maven Project".
Alternatively, you can use a fully local copy:
- Go to https://github.com/Innoxia/liliths-throne-public in your preferred web browser and click "Clone or Download", then "Download ZIP".
- Extract the zip file where you want the project to be.
- In IDEA, go to "File" > "New" > "Project from Existing Sources".
- Navigate to the folder you extracted in step 2, select it and click "OK".
- In the next prompt, select "Import project from external model" and pick "Maven".
- Click "Next" multiple times and then "Finish". Configure the project as desired, but the default settings should be fine.
Your IDE should now load the project tree with ressources, sources, etc. and generate project files as needed. Next, you need to create run configurations:
- For the default quick start, press Ctrl + Shift + A and search for "Edit Configurations". Open the action with that name.
- In the dialogue, click the "+" in the top left corner and choose "Application".
- Pick a name for the configuration that you will recognize (e.g. "Build and run").
- Click the "..." next to the "Main class" text field and search for "Main". Pick the class with that name (com.lilithsthrone.main) and click "OK".
- Click "Apply" and/or "OK".
You should now be able to build and run the game using the new run configuration (which should be selected by default). The default hotkey is Shift + F10. Since this does not create a .jar file, you can add Maven run configurations to package and deploy a file that you can move to another computer:
- Return to the "Edit Configurations" window (use Ctrl + Shift + A if you can't find it).
- Click the "+" and add a "Maven" configuration.
- Pick a name for the configuration (e.g. "Package .jar")
- Set "package" as the command option (without quotation marks).
- Click "Apply" and/or "OK".
Running the newly created configuration (Shift + F10, make sure that the correct configuration is selected in the top right corner) should create a runnable .jar file in the "target" directory within your working directory. You can rename this file to whatever you want.
Note that executing it will display a warning that the "res" folder wasn't found. This is because it is copied to the wrong location during the Maven building process. You can manually copy it either from your project root directory or from "target/classes" so that it resides in the same directory as the .jar file. Also note that the "data" directory (that stores settings and save games) may be overriden during the building process, so make a backup of it beforehand.
The Main class isn't recognized and unresolved symbol errors for Java
The importer sometimes fails to set the correct JDK for your project.
- Open the "Project Structure" dialogue (the default keybind is Ctrl + Shift + Alt + S or search for it with Ctrl + Shift + A)
- In the "Project" tab, select an appropriate project SDK from the drop-down menu.
- If there is none, click "New..." > "JDK" and locate it manually. Note that it must be for Java version 1.8 or higher.