Compiling from Source: Difference between revisions
Jump to navigation
Jump to search
imported>Ulti |
|||
Line 10: | Line 10: | ||
# Compiling creates a "build" and "dist" folder. The end program is in dist/Kolmafia.jar. | # Compiling creates a "build" and "dist" folder. The end program is in dist/Kolmafia.jar. | ||
===Troubleshooting=== | ===Troubleshooting=== | ||
Due to how bat files work, ''ant.bat'' will auto-close | ====Double-Clicking ''ant.bat''==== | ||
When you run it again, you'll be able to read its output. If you get an error message about "tools.jar" not being found, this means you're trying to build with the JRE (which doesn't contain this file) rather than the JDK (which contains it).<br> | Due to how bat files work when you double-click them, ''ant.bat'' will auto-close before you can read its output. | ||
# ant assumes that builds are done from a command shell. You'll need to run from the command shell to execute any ant target other than the default, such as ''ant.bat exec'' or ''ant.bat daily'' | |||
# An easy workaround is to add a "pause" near the bottom of the file before it has a chance to auto-close on you.<br>When you run it again, you'll be able to read its output and it will exit after you ''Press any key to continue...'' | |||
# Alternatively, you can create a wrapper batch file that calls the existing ''ant.bat'' file and adds a pause after executing it. This method allows you to set different ant targets and also prevents updates to ant from overwriting your modifications. | |||
====''tools.jar'' not found==== | |||
If you get an error message about "tools.jar" not being found, this means you're trying to build with the JRE (which doesn't contain this file) rather than the JDK (which contains it).<br> | |||
To fix this, right click on ''my computer'' -> ''properties'' -> ''advanced system settings'' -> ''Environment Variables...'' then make sure your PATH contains a reference to the location of your JDK directory. | To fix this, right click on ''my computer'' -> ''properties'' -> ''advanced system settings'' -> ''Environment Variables...'' then make sure your PATH contains a reference to the location of your JDK directory. | ||
Revision as of 01:55, 4 December 2020
To contribute to the Mafia project, you'll need to be able to install the Java Development Kit, connect to the SVN and be comfortable writing Java Code. Instructions for the first two are included below:
Windows
- Download and install the Java Development Kit, available here: http://java.sun.com/javase/downloads/index.jsp
- Download and install Subversion, available here: http://www.collab.net/downloads/subversion/
- Download and install Tortoise SVN (or of course, another SVN program), available here: http://tortoisesvn.tigris.org/
- Download and install WinAnt, available here: http://code.google.com/p/winant/
- Connect to the SVN server and download the source code for the Mafia Project. Using Tortoise SVN, you have to right-click on your desktop, select "SVN Checkout", and put the URL of the repository as "svn://svn.code.sf.net/p/kolmafia/code/". Leave all other settings as they are, and click OK.
- Copy C:/Program Files/WinAnt/bin/ant.bat to your Desktop/kolmafia/ folder. If you have set up WinAnt correctly (and it's hard not to - there aren't many options) then double clicking on this file should compile the program.
- Compiling creates a "build" and "dist" folder. The end program is in dist/Kolmafia.jar.
Troubleshooting
Double-Clicking ant.bat
Due to how bat files work when you double-click them, ant.bat will auto-close before you can read its output.
- ant assumes that builds are done from a command shell. You'll need to run from the command shell to execute any ant target other than the default, such as ant.bat exec or ant.bat daily
- An easy workaround is to add a "pause" near the bottom of the file before it has a chance to auto-close on you.
When you run it again, you'll be able to read its output and it will exit after you Press any key to continue... - Alternatively, you can create a wrapper batch file that calls the existing ant.bat file and adds a pause after executing it. This method allows you to set different ant targets and also prevents updates to ant from overwriting your modifications.
tools.jar not found
If you get an error message about "tools.jar" not being found, this means you're trying to build with the JRE (which doesn't contain this file) rather than the JDK (which contains it).
To fix this, right click on my computer -> properties -> advanced system settings -> Environment Variables... then make sure your PATH contains a reference to the location of your JDK directory.
Linux
- Install Sun Java Development Kit ( debian: apt-get install sun-java6-jdk )
- Install Subversion ( debian: apt-get install svn )
- Install Ant ( debian: apt-get install ant )
- Connect to the SVN server and download the source code for the Mafia Project. ( svn checkout svn://svn.code.sf.net/p/kolmafia/code/ kolmafia )
- Verify tou are using sun-java with ( debian: update-alternatives --all )
- I had to change $JAVA_HOME to compile ( export JAVA_HOME=/usr/lib/jvm/java-6-sun-1.6.0.12 )
- Compile kolmafia with Ant ( debian: cd kolmafia && ant debian )
- Install kolmafia ( debian: cd dist && dpkg -i kolmafia*.deb )
MacOSX
- Install the appropriate developer tools for your version of MacOSX from the Mac Dev Center (http://developer.apple.com/devcenter/mac/index.action) or from your original OS install disks.
- Open a new terminal window and navigate to the directory to which you wish to create kolmafia (e.g. cd ~/Projects, or some similar directory)
- Connect to the SVN server and download the source code for the Mafia Project. (svn checkout svn://svn.code.sf.net/p/kolmafia/code/ kolmafia )
- Compile kolmafia with Ant (cd kolmafia && ant jarbundler) (use ant daily jarbundler after the initial install to update kol and build in one step)
- copy the application to your preferred location: (cp ./dist/KoLMafia.app /Applications)