https://wiki.kolmafia.us/api.php?action=feedcontributions&user=HippoKing&feedformat=atomKolmafia - User contributions [en]2024-03-28T15:51:05ZUser contributionsMediaWiki 1.35.0https://wiki.kolmafia.us/index.php?title=Mafia_directories&diff=9131Mafia directories2021-12-24T02:55:52Z<p>HippoKing: I don't know why I keep editing this wiki. I'm not even sure I'm helping.</p>
<hr />
<div>* '''Windows''' users probably saved the mafia .jar (or .exe) in a folder/directory. This is the '''only''' directory that is used. Mafia, when first started, will have produced a load of sub-directories that it uses to store stuff. These will have names such as "buffs", "ccs", "clan", "data", "images", "relay", "scripts", "sessions" and "settings" (maybe not all of those, maybe some others) with stuff inside. <br />
<br />
* '''Mac''' users have theirs saved under "~/Library/Application Support/KoLmafia/"<br />
<br />
* '''Linux''' Your Mafia files will be saved in a hidden folder in your home directory. Go to <pre> ~/.kolmafia </pre> The tilde is your home directory, the period at the start makes that folder hidden. If you're using a CLI, you shouldn't have a problem. If you like GUIs, either turn on showing hidden stuff or just start one inside, like:<pre> cd ~/.kolmafia && nautilus </pre><br />
<br />
[[Category:Tech Support]]</div>HippoKinghttps://wiki.kolmafia.us/index.php?title=Compiling_from_Source&diff=9122Compiling from Source2021-11-13T11:11:25Z<p>HippoKing: /* KoLmafia has migrated to the GitHub repository and we are retooling for GIT and gradle builds. */ it's no longer "exactly nothing" accurate below the line</p>
<hr />
<div>=== GREAT BIG NEWS ===<br />
<br />
==KoLmafia has migrated to the GitHub repository and we are retooling for GIT and gradle builds.==<br />
The Windows section of this page is currently out of date. The Linux and macOS ones have been updated.<br />
<br />
The good news is that the IDE setup is a lot easier. The bad news is you'll need to take some steps to build anything. In addition, we are discussing changing to a newer required JDK, so even these instructions will not be permanent.<br />
<br />
<br />
<br />
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:<br />
<br />
==Windows==<br />
# Download Tools<br />
## Download and install Java Development Kit 1.8 or newer, available from [https://www.oracle.com/java/technologies/javase-downloads.html Oracle] or [https://adoptopenjdk.net AdoptOpenJDK]<br />
## Download and install Subversion, from [https://subversion.apache.org/packages.html apache.org]<br />
## Download and install Tortoise SVN (or of course, another SVN program)from [https://tortoisesvn.net/downloads.html tortoisesvn]<br />
## Download and install ANT, from [https://ant.apache.org/bindownload.cgi apache.org]<br />
# Configure Windows Environment Variables[[File:Environment vars.jpg|thumb|Win 10 Environment Variable Editor]]<br />
## Windows 10<br />
### Go to settings<br />
### type 'enviro' in the search<br />
### click on the 'edit environment variables' suggestion<br />
### add or edit ANT_HOME, JAVA_HOME, and PATH variables<br>''PATH should include ANT_HOME/bin and JAVA_HOME''</br>If ANT or JAVA installers have already set these variables, they can be updated or left alone.<br />
# Get Source and Build<br />
## 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.<br />
## Copy %ANT_HOME%/bin/ant.bat to your Desktop/kolmafia/ folder. If you have set up ANT correctly (and it's hard not to - there aren't many options) then double clicking on this file should compile the program.<br />
# Compiling creates a "build" and "dist" folder. The end program is in dist/Kolmafia.jar.<br />
===Troubleshooting===<br />
====Double-Clicking ''ant.bat''====<br />
Due to how bat files work when you double-click them, ''ant.bat'' will auto-close before you can read its output.<br />
# 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 update exec'' or ''ant.bat daily</br>ant -projecthelp'' will list all main targets<br />
# 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...''<br />
# 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.<br />
<blockquote>Example of a very simple MyWrapper.bat file<pre><br />
# This is a wrapper batch file<br />
# First it runs ant<br />
call ant.bat daily<br />
# Then it pauses<br />
pause</pre></blockquote><br />
<br />
====''tools.jar'' not found====<br />
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><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.<br />
<br />
==Linux==<br />
<br />
Do once:<br />
# Install git - you probably already have this. If not, follow [https://www.atlassian.com/git/tutorials/install-git#linux this guide.]<br />
# Get an appropriate JDK. The safest and easiest way to do this is with [https://adoptium.net/installation.html#x64_linux-jdk Adoptium].<br />
# Clone the repo:<br />
## If you have a github account:<syntaxhighlight lang="bash"><br />
git clone git@github.com:kolmafia/kolmafia.git<br />
</syntaxhighlight>If not:<pre>git clone https://github.com/kolmafia/kolmafia.git</pre><br />
<br />
Do every session:<br />
Set up your environment to use that JDK you just downloaded<pre> export PATH="/where/you/put/that/jdk/bin:${PATH}"</pre><br />
<br />
Actually compile:<pre>cd /where/you/cloned/kolmafia</pre><br />
<pre>./gradlew clean shadowJar</pre><br />
<br />
Get new updates with <pre>git pull</pre><br />
<br />
You have a KoLmafia jar file that can be invoked with <pre>java -jar dist/KoLmafia-*.jar</pre><br />
<br />
Do other installation steps as you wish.<br />
<br />
==MacOSX (updated for Git/Gradle)==<br />
# Verify required packages<br />
## <code>''java --version''</code><br />
##* if not found or less than Java 11... Install Java Development Kit version 17 from [https://adoptium.net Adoptium Temurin]<br />
## <code>''git --version''</code><br />
##* If not found ... Install git: Atlassian has a great document on [https://www.atlassian.com/git/tutorials/install-git the various ways to install Git]<br />
# Configure development environment<br>Most of these steps can be included in ''<code>.profile</code>'' or the equivalent for your terminal of choice.<br />
## In the terminal set JAVA_HOME to the java home directory. <br>''<code>/usr/libexec/java_home -V</code>'' will list all known values for java_home.<br>If you have multiple copies of java, choose the version you want to use''.'' <code>''export JAVA_HOME=`/usr/libexec/java_home -v17''</code><br />
# Open a new terminal window and navigate to the directory to which you wish to create kolmafia (e.g. <code>cd ~/projects</code>, or some similar directory)<br />
# Clone the source code for the KoLmafia Project.<br>''<code>git clone git@github.com:kolmafia/kolmafia.git</code>''<br />
# Compile KoLmafia with the Gradle wrapper ''<code>cd kolmafia && ./gradlew runShadow</code>''<br />
<br />
=== Optional ===<br />
If you intend to commit code to GitHub, you will need to follow GitHub's instructions for [https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token adding a Personal Access Token (PAT)]<br />
''[[Category:Tech Support]]''</div>HippoKinghttps://wiki.kolmafia.us/index.php?title=Compiling_from_Source&diff=9121Compiling from Source2021-11-13T10:42:37Z<p>HippoKing: /* Linux */ github can't do anonymous clones except by http</p>
<hr />
<div>=== GREAT BIG NEWS ===<br />
<br />
==KoLmafia has migrated to the GitHub repository and we are retooling for GIT and gradle builds.==<br />
Exactly nothing below here is accurate, and we'll need to do a thorough cleanup of this page and the IDE setup page.<br />
<br />
The good news is that the IDE setup is a lot easier. The bad news is you'll need to take some steps to build anything. In addition, we are discussing changing to a newer required JDK, so even these instructions will not be permanent.<br />
<br />
<br />
<br />
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:<br />
<br />
==Windows==<br />
# Download Tools<br />
## Download and install Java Development Kit 1.8 or newer, available from [https://www.oracle.com/java/technologies/javase-downloads.html Oracle] or [https://adoptopenjdk.net AdoptOpenJDK]<br />
## Download and install Subversion, from [https://subversion.apache.org/packages.html apache.org]<br />
## Download and install Tortoise SVN (or of course, another SVN program)from [https://tortoisesvn.net/downloads.html tortoisesvn]<br />
## Download and install ANT, from [https://ant.apache.org/bindownload.cgi apache.org]<br />
# Configure Windows Environment Variables[[File:Environment vars.jpg|thumb|Win 10 Environment Variable Editor]]<br />
## Windows 10<br />
### Go to settings<br />
### type 'enviro' in the search<br />
### click on the 'edit environment variables' suggestion<br />
### add or edit ANT_HOME, JAVA_HOME, and PATH variables<br>''PATH should include ANT_HOME/bin and JAVA_HOME''</br>If ANT or JAVA installers have already set these variables, they can be updated or left alone.<br />
# Get Source and Build<br />
## 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.<br />
## Copy %ANT_HOME%/bin/ant.bat to your Desktop/kolmafia/ folder. If you have set up ANT correctly (and it's hard not to - there aren't many options) then double clicking on this file should compile the program.<br />
# Compiling creates a "build" and "dist" folder. The end program is in dist/Kolmafia.jar.<br />
===Troubleshooting===<br />
====Double-Clicking ''ant.bat''====<br />
Due to how bat files work when you double-click them, ''ant.bat'' will auto-close before you can read its output.<br />
# 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 update exec'' or ''ant.bat daily</br>ant -projecthelp'' will list all main targets<br />
# 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...''<br />
# 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.<br />
<blockquote>Example of a very simple MyWrapper.bat file<pre><br />
# This is a wrapper batch file<br />
# First it runs ant<br />
call ant.bat daily<br />
# Then it pauses<br />
pause</pre></blockquote><br />
<br />
====''tools.jar'' not found====<br />
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><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.<br />
<br />
==Linux==<br />
<br />
Do once:<br />
# Install git - you probably already have this. If not, follow [https://www.atlassian.com/git/tutorials/install-git#linux this guide.]<br />
# Get an appropriate JDK. The safest and easiest way to do this is with [https://adoptium.net/installation.html#x64_linux-jdk Adoptium].<br />
# Clone the repo:<br />
## If you have a github account:<syntaxhighlight lang="bash"><br />
git clone git@github.com:kolmafia/kolmafia.git<br />
</syntaxhighlight>If not:<pre>git clone https://github.com/kolmafia/kolmafia.git</pre><br />
<br />
Do every session:<br />
Set up your environment to use that JDK you just downloaded<pre> export PATH="/where/you/put/that/jdk/bin:${PATH}"</pre><br />
<br />
Actually compile:<pre>cd /where/you/cloned/kolmafia</pre><br />
<pre>./gradlew clean shadowJar</pre><br />
<br />
Get new updates with <pre>git pull</pre><br />
<br />
You have a KoLmafia jar file that can be invoked with <pre>java -jar dist/KoLmafia-*.jar</pre><br />
<br />
Do other installation steps as you wish.<br />
<br />
==MacOSX (updated for Git/Gradle)==<br />
# Verify required packages<br />
## <code>''java --version''</code><br />
##* if not found or less than Java 11... Install Java Development Kit version 17 from [https://adoptium.net Adoptium Temurin]<br />
## <code>''git --version''</code><br />
##* If not found ... Install git: Atlassian has a great document on [https://www.atlassian.com/git/tutorials/install-git the various ways to install Git]<br />
# Configure development environment<br>Most of these steps can be included in ''<code>.profile</code>'' or the equivalent for your terminal of choice.<br />
## In the terminal set JAVA_HOME to the java home directory. <br>''<code>/usr/libexec/java_home -V</code>'' will list all known values for java_home.<br>If you have multiple copies of java, choose the version you want to use''.'' <code>''export JAVA_HOME=`/usr/libexec/java_home -v17''</code><br />
# Open a new terminal window and navigate to the directory to which you wish to create kolmafia (e.g. <code>cd ~/projects</code>, or some similar directory)<br />
# Clone the source code for the KoLmafia Project.<br>''<code>git clone git@github.com:kolmafia/kolmafia.git</code>''<br />
# Compile KoLmafia with the Gradle wrapper ''<code>cd kolmafia && ./gradlew runShadow</code>''<br />
<br />
=== Optional ===<br />
If you intend to commit code to GitHub, you will need to follow GitHub's instructions for [https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token adding a Personal Access Token (PAT)]<br />
''[[Category:Tech Support]]''</div>HippoKinghttps://wiki.kolmafia.us/index.php?title=Compiling_from_Source&diff=9120Compiling from Source2021-11-13T10:34:21Z<p>HippoKing: /* Linux */ god I suck at wiki syntax</p>
<hr />
<div>=== GREAT BIG NEWS ===<br />
<br />
==KoLmafia has migrated to the GitHub repository and we are retooling for GIT and gradle builds.==<br />
Exactly nothing below here is accurate, and we'll need to do a thorough cleanup of this page and the IDE setup page.<br />
<br />
The good news is that the IDE setup is a lot easier. The bad news is you'll need to take some steps to build anything. In addition, we are discussing changing to a newer required JDK, so even these instructions will not be permanent.<br />
<br />
<br />
<br />
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:<br />
<br />
==Windows==<br />
# Download Tools<br />
## Download and install Java Development Kit 1.8 or newer, available from [https://www.oracle.com/java/technologies/javase-downloads.html Oracle] or [https://adoptopenjdk.net AdoptOpenJDK]<br />
## Download and install Subversion, from [https://subversion.apache.org/packages.html apache.org]<br />
## Download and install Tortoise SVN (or of course, another SVN program)from [https://tortoisesvn.net/downloads.html tortoisesvn]<br />
## Download and install ANT, from [https://ant.apache.org/bindownload.cgi apache.org]<br />
# Configure Windows Environment Variables[[File:Environment vars.jpg|thumb|Win 10 Environment Variable Editor]]<br />
## Windows 10<br />
### Go to settings<br />
### type 'enviro' in the search<br />
### click on the 'edit environment variables' suggestion<br />
### add or edit ANT_HOME, JAVA_HOME, and PATH variables<br>''PATH should include ANT_HOME/bin and JAVA_HOME''</br>If ANT or JAVA installers have already set these variables, they can be updated or left alone.<br />
# Get Source and Build<br />
## 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.<br />
## Copy %ANT_HOME%/bin/ant.bat to your Desktop/kolmafia/ folder. If you have set up ANT correctly (and it's hard not to - there aren't many options) then double clicking on this file should compile the program.<br />
# Compiling creates a "build" and "dist" folder. The end program is in dist/Kolmafia.jar.<br />
===Troubleshooting===<br />
====Double-Clicking ''ant.bat''====<br />
Due to how bat files work when you double-click them, ''ant.bat'' will auto-close before you can read its output.<br />
# 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 update exec'' or ''ant.bat daily</br>ant -projecthelp'' will list all main targets<br />
# 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...''<br />
# 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.<br />
<blockquote>Example of a very simple MyWrapper.bat file<pre><br />
# This is a wrapper batch file<br />
# First it runs ant<br />
call ant.bat daily<br />
# Then it pauses<br />
pause</pre></blockquote><br />
<br />
====''tools.jar'' not found====<br />
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><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.<br />
<br />
==Linux==<br />
<br />
Do once:<br />
# Install git - you probably already have this. If not, follow [https://www.atlassian.com/git/tutorials/install-git#linux this guide.]<br />
# Get an appropriate JDK. The safest and easiest way to do this is with [https://adoptium.net/installation.html#x64_linux-jdk Adoptium].<br />
# Clone the repo: <pre>git clone https://github.com/kolmafia/kolmafia.git</pre><br />
<br />
Do every session:<br />
Set up your environment to use that JDK you just downloaded<pre> export PATH="/where/you/put/that/jdk/bin:${PATH}"</pre><br />
<br />
Actually compile:<pre>cd /where/you/cloned/kolmafia</pre><br />
<pre>./gradlew clean shadowJar</pre><br />
<br />
Get new updates with <pre>git pull</pre><br />
<br />
You have a KoLmafia jar file that can be invoked with <pre>java -jar dist/KoLmafia-*.jar</pre><br />
<br />
Do other installation steps as you wish.<br />
<br />
==MacOSX (updated for Git/Gradle)==<br />
# Verify required packages<br />
## <code>''java --version''</code><br />
##* if not found or less than Java 11... Install Java Development Kit version 17 from [https://adoptium.net Adoptium Temurin]<br />
## <code>''git --version''</code><br />
##* If not found ... Install git: Atlassian has a great document on [https://www.atlassian.com/git/tutorials/install-git the various ways to install Git]<br />
# Configure development environment<br>Most of these steps can be included in ''<code>.profile</code>'' or the equivalent for your terminal of choice.<br />
## In the terminal set JAVA_HOME to the java home directory. <br>''<code>/usr/libexec/java_home -V</code>'' will list all known values for java_home.<br>If you have multiple copies of java, choose the version you want to use''.'' <code>''export JAVA_HOME=`/usr/libexec/java_home -v17''</code><br />
# Open a new terminal window and navigate to the directory to which you wish to create kolmafia (e.g. <code>cd ~/projects</code>, or some similar directory)<br />
# Clone the source code for the KoLmafia Project.<br>''<code>git clone git@github.com:kolmafia/kolmafia.git</code>''<br />
# Compile KoLmafia with the Gradle wrapper ''<code>cd kolmafia && ./gradlew runShadow</code>''<br />
<br />
=== Optional ===<br />
If you intend to commit code to GitHub, you will need to follow GitHub's instructions for [https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token adding a Personal Access Token (PAT)]<br />
''[[Category:Tech Support]]''</div>HippoKinghttps://wiki.kolmafia.us/index.php?title=Compiling_from_Source&diff=9119Compiling from Source2021-11-13T10:31:40Z<p>HippoKing: /* Linux */ remove outdated instructions, suggest Adoptium for JDK</p>
<hr />
<div>=== GREAT BIG NEWS ===<br />
<br />
==KoLmafia has migrated to the GitHub repository and we are retooling for GIT and gradle builds.==<br />
Exactly nothing below here is accurate, and we'll need to do a thorough cleanup of this page and the IDE setup page.<br />
<br />
The good news is that the IDE setup is a lot easier. The bad news is you'll need to take some steps to build anything. In addition, we are discussing changing to a newer required JDK, so even these instructions will not be permanent.<br />
<br />
<br />
<br />
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:<br />
<br />
==Windows==<br />
# Download Tools<br />
## Download and install Java Development Kit 1.8 or newer, available from [https://www.oracle.com/java/technologies/javase-downloads.html Oracle] or [https://adoptopenjdk.net AdoptOpenJDK]<br />
## Download and install Subversion, from [https://subversion.apache.org/packages.html apache.org]<br />
## Download and install Tortoise SVN (or of course, another SVN program)from [https://tortoisesvn.net/downloads.html tortoisesvn]<br />
## Download and install ANT, from [https://ant.apache.org/bindownload.cgi apache.org]<br />
# Configure Windows Environment Variables[[File:Environment vars.jpg|thumb|Win 10 Environment Variable Editor]]<br />
## Windows 10<br />
### Go to settings<br />
### type 'enviro' in the search<br />
### click on the 'edit environment variables' suggestion<br />
### add or edit ANT_HOME, JAVA_HOME, and PATH variables<br>''PATH should include ANT_HOME/bin and JAVA_HOME''</br>If ANT or JAVA installers have already set these variables, they can be updated or left alone.<br />
# Get Source and Build<br />
## 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.<br />
## Copy %ANT_HOME%/bin/ant.bat to your Desktop/kolmafia/ folder. If you have set up ANT correctly (and it's hard not to - there aren't many options) then double clicking on this file should compile the program.<br />
# Compiling creates a "build" and "dist" folder. The end program is in dist/Kolmafia.jar.<br />
===Troubleshooting===<br />
====Double-Clicking ''ant.bat''====<br />
Due to how bat files work when you double-click them, ''ant.bat'' will auto-close before you can read its output.<br />
# 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 update exec'' or ''ant.bat daily</br>ant -projecthelp'' will list all main targets<br />
# 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...''<br />
# 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.<br />
<blockquote>Example of a very simple MyWrapper.bat file<pre><br />
# This is a wrapper batch file<br />
# First it runs ant<br />
call ant.bat daily<br />
# Then it pauses<br />
pause</pre></blockquote><br />
<br />
====''tools.jar'' not found====<br />
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><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.<br />
<br />
==Linux==<br />
<br />
Do once:<br />
# Install git - you probably already have this. If not, follow [https://www.atlassian.com/git/tutorials/install-git#linux this guide.]<br />
# Get an appropriate JDK. The safest and easiest way to do this is with [https://adoptium.net/installation.html#x64_linux-jdk Adoptium].<br />
# Clone the repo: <pre>git clone https://github.com/kolmafia/kolmafia.git</pre><br />
<br />
Do every session:<br />
# Set up your environment to use that JDK you just downloaded<br />
<pre> export PATH="/where/you/put/that/jdk/bin:${PATH}"</pre><br />
<br />
Actually compile:<br />
#<pre>cd /where/you/cloned/kolmafia<br />
./gradlew clean shadowJar</pre><br />
<br />
Get new updates with <pre>git pull</pre><br />
<br />
You have a KoLmafia jar file that can be invoked with <pre>java -jar dist/KoLmafia-*.jar</pre><br />
<br />
Do other installation steps as you wish.<br />
<br />
==MacOSX (updated for Git/Gradle)==<br />
# Verify required packages<br />
## <code>''java --version''</code><br />
##* if not found or less than Java 11... Install Java Development Kit version 17 from [https://adoptium.net Adoptium Temurin]<br />
## <code>''git --version''</code><br />
##* If not found ... Install git: Atlassian has a great document on [https://www.atlassian.com/git/tutorials/install-git the various ways to install Git]<br />
# Configure development environment<br>Most of these steps can be included in ''<code>.profile</code>'' or the equivalent for your terminal of choice.<br />
## In the terminal set JAVA_HOME to the java home directory. <br>''<code>/usr/libexec/java_home -V</code>'' will list all known values for java_home.<br>If you have multiple copies of java, choose the version you want to use''.'' <code>''export JAVA_HOME=`/usr/libexec/java_home -v17''</code><br />
# Open a new terminal window and navigate to the directory to which you wish to create kolmafia (e.g. <code>cd ~/projects</code>, or some similar directory)<br />
# Clone the source code for the KoLmafia Project.<br>''<code>git clone git@github.com:kolmafia/kolmafia.git</code>''<br />
# Compile KoLmafia with the Gradle wrapper ''<code>cd kolmafia && ./gradlew runShadow</code>''<br />
<br />
=== Optional ===<br />
If you intend to commit code to GitHub, you will need to follow GitHub's instructions for [https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token adding a Personal Access Token (PAT)]<br />
''[[Category:Tech Support]]''</div>HippoKinghttps://wiki.kolmafia.us/index.php?title=Compiling_from_Source&diff=8991Compiling from Source2021-04-17T23:34:12Z<p>HippoKing: /* Linux */ no need to specific a version, use java latest</p>
<hr />
<div>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:<br />
<br />
==Windows==<br />
# Download Tools<br />
## Download and install Java Development Kit 1.8 or newer, available from [https://www.oracle.com/java/technologies/javase-downloads.html Oracle] or [https://adoptopenjdk.net AdoptOpenJDK]<br />
## Download and install Subversion, from [https://subversion.apache.org/packages.html apache.org]<br />
## Download and install Tortoise SVN (or of course, another SVN program)from [https://tortoisesvn.net/downloads.html tortoisesvn]<br />
## Download and install ANT, from [https://ant.apache.org/bindownload.cgi apache.org]<br />
# Configure Windows Environment Variables[[File:Environment vars.jpg|thumb|Win 10 Environment Variable Editor]]<br />
## Windows 10<br />
### Go to settings<br />
### type 'enviro' in the search<br />
### click on the 'edit environment variables' suggestion<br />
### add or edit ANT_HOME, JAVA_HOME, and PATH variables<br>''PATH should include ANT_HOME/bin and JAVA_HOME''</br>If ANT or JAVA installers have already set these variables, they can be updated or left alone.<br />
# Get Source and Build<br />
## 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.<br />
## Copy %ANT_HOME%/bin/ant.bat to your Desktop/kolmafia/ folder. If you have set up ANT correctly (and it's hard not to - there aren't many options) then double clicking on this file should compile the program.<br />
# Compiling creates a "build" and "dist" folder. The end program is in dist/Kolmafia.jar.<br />
===Troubleshooting===<br />
====Double-Clicking ''ant.bat''====<br />
Due to how bat files work when you double-click them, ''ant.bat'' will auto-close before you can read its output.<br />
# 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 update exec'' or ''ant.bat daily</br>ant -projecthelp'' will list all main targets<br />
# 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...''<br />
# 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.<br />
<blockquote>Example of a very simple MyWrapper.bat file<pre><br />
# This is a wrapper batch file<br />
# First it runs ant<br />
call ant.bat daily<br />
# Then it pauses<br />
pause</pre></blockquote><br />
<br />
====''tools.jar'' not found====<br />
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><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.<br />
<br />
==Linux==<br />
<br />
# Install Sun Java Development Kit ( debian: apt-get install sun-java6-jdk )<br />
# Install Subversion ( debian: apt-get install svn )<br />
# Install Ant ( debian: apt-get install ant )<br />
# 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 )<br />
# Verify tou are using sun-java with ( debian: update-alternatives --all )<br />
# I had to change $JAVA_HOME to compile ( export JAVA_HOME=/usr/lib/jvm/java-6-sun-1.6.0.12 )<br />
# Compile kolmafia with Ant ( debian: cd kolmafia && ant debian )<br />
# Install kolmafia ( debian: cd dist && dpkg -i kolmafia*.deb )<br />
<br />
===Fedora (or probably other RPM systems)===<br />
<br />
# Install Subversion: <pre>sudo yum install sqlite-devel subversion </pre><br />
# Install Java JDK: <pre>sudo yum install java-latest-openjdk-devel</pre><br />
# Install Ant: <pre>sudo yum install ant</pre><br />
# Checkout: <pre>svn checkout svn://svn.code.sf.net/p/kolmafia/code/ kolmafia</pre><br />
# Build: <pre>cd kolmafia && ant</pre></pre><br />
<br />
You have a KoLmafia jar file that can be invoked with <pre>java -jar dist/KoLmafia-*.jar</pre><br />
<br />
Do other installation steps as you wish.<br />
<br />
==MacOSX==<br />
# Install required packages</br>''MacOS X packages for Java, subversion, and ANT may also be installed via a package manager like [https://brew.sh Homebrew] or [https://www.macports.org MacPorts]. The instructions are written for a direct installation of the packages.''<br />
## Install Java Development Kit version 1.8 or newer from [https://www.oracle.com/java/technologies/javase-downloads.html Oracle] or [https://adoptopenjdk.net OpenJDK] <br />
## Install Subversion 1.10 or newer from [https://subversion.apache.org/packages.html apache.org]<br />
## Install Ant 1.9 or newer from [https://ant.apache.org/bindownload.cgi apache.org]<br />
# Configure development environment</br>Most of these steps can be included in ''.profile'' or the equivalent for your terminal of choice.<br />
## In the terminal set JAVA_HOME to the java home directory. </br>''/usr/libexec/java_home -V'' will list all known values for java_home.</br>If you have multiple copies of java, choose the version you want to us''e.<br />
## In the terminal set ANT_HOME to the location of ANT. e.g. ''/opt/ant''<br />
## In the terminal make sure that Ant and subversion are in your ${PATH} variable. e.g.''PATH=${PATH}:/usr/local/opt/subversion/bin:/usr/local/ant/bin''<br />
# 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)<br />
# Connect to the SVN server and download the source code for the KoLmafia Project.</br>''svn checkout <nowiki>svn://svn.code.sf.net/p/kolmafia/code/</nowiki> kolmafia''<br />
# Compile KoLmafia with Ant (''cd kolmafia && ant daily'') <br />
# execute KoLmafia with the command ''java -jar dist/KoLmafia-*.jar<br />
<br />
[[Category:Tech Support]]</div>HippoKinghttps://wiki.kolmafia.us/index.php?title=Compiling_from_Source&diff=8990Compiling from Source2021-04-17T22:53:37Z<p>HippoKing: /* Linux */ simple RPM build.</p>
<hr />
<div>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:<br />
<br />
==Windows==<br />
# Download Tools<br />
## Download and install Java Development Kit 1.8 or newer, available from [https://www.oracle.com/java/technologies/javase-downloads.html Oracle] or [https://adoptopenjdk.net AdoptOpenJDK]<br />
## Download and install Subversion, from [https://subversion.apache.org/packages.html apache.org]<br />
## Download and install Tortoise SVN (or of course, another SVN program)from [https://tortoisesvn.net/downloads.html tortoisesvn]<br />
## Download and install ANT, from [https://ant.apache.org/bindownload.cgi apache.org]<br />
# Configure Windows Environment Variables[[File:Environment vars.jpg|thumb|Win 10 Environment Variable Editor]]<br />
## Windows 10<br />
### Go to settings<br />
### type 'enviro' in the search<br />
### click on the 'edit environment variables' suggestion<br />
### add or edit ANT_HOME, JAVA_HOME, and PATH variables<br>''PATH should include ANT_HOME/bin and JAVA_HOME''</br>If ANT or JAVA installers have already set these variables, they can be updated or left alone.<br />
# Get Source and Build<br />
## 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.<br />
## Copy %ANT_HOME%/bin/ant.bat to your Desktop/kolmafia/ folder. If you have set up ANT correctly (and it's hard not to - there aren't many options) then double clicking on this file should compile the program.<br />
# Compiling creates a "build" and "dist" folder. The end program is in dist/Kolmafia.jar.<br />
===Troubleshooting===<br />
====Double-Clicking ''ant.bat''====<br />
Due to how bat files work when you double-click them, ''ant.bat'' will auto-close before you can read its output.<br />
# 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 update exec'' or ''ant.bat daily</br>ant -projecthelp'' will list all main targets<br />
# 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...''<br />
# 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.<br />
<blockquote>Example of a very simple MyWrapper.bat file<pre><br />
# This is a wrapper batch file<br />
# First it runs ant<br />
call ant.bat daily<br />
# Then it pauses<br />
pause</pre></blockquote><br />
<br />
====''tools.jar'' not found====<br />
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><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.<br />
<br />
==Linux==<br />
<br />
# Install Sun Java Development Kit ( debian: apt-get install sun-java6-jdk )<br />
# Install Subversion ( debian: apt-get install svn )<br />
# Install Ant ( debian: apt-get install ant )<br />
# 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 )<br />
# Verify tou are using sun-java with ( debian: update-alternatives --all )<br />
# I had to change $JAVA_HOME to compile ( export JAVA_HOME=/usr/lib/jvm/java-6-sun-1.6.0.12 )<br />
# Compile kolmafia with Ant ( debian: cd kolmafia && ant debian )<br />
# Install kolmafia ( debian: cd dist && dpkg -i kolmafia*.deb )<br />
<br />
===Fedora (or probably other RPM systems)===<br />
<br />
# Install Subversion: <pre>sudo yum install sqlite-devel subversion </pre><br />
# Install Java JDK: <pre>sudo yum install java-11-openjdk-devel</pre><br />
# Install Ant: <pre>sudo yum install ant</pre><br />
# Checkout: <pre>svn checkout svn://svn.code.sf.net/p/kolmafia/code/ kolmafia</pre><br />
# Build: <pre>cd kolmafia && ant</pre></pre><br />
<br />
You have a KoLmafia jar file that can be invoked with <pre>java -jar dist/KoLmafia-*.jar</pre><br />
<br />
Do other installation steps as you wish.<br />
<br />
==MacOSX==<br />
# Install required packages</br>''MacOS X packages for Java, subversion, and ANT may also be installed via a package manager like [https://brew.sh Homebrew] or [https://www.macports.org MacPorts]. The instructions are written for a direct installation of the packages.''<br />
## Install Java Development Kit version 1.8 or newer from [https://www.oracle.com/java/technologies/javase-downloads.html Oracle] or [https://adoptopenjdk.net OpenJDK] <br />
## Install Subversion 1.10 or newer from [https://subversion.apache.org/packages.html apache.org]<br />
## Install Ant 1.9 or newer from [https://ant.apache.org/bindownload.cgi apache.org]<br />
# Configure development environment</br>Most of these steps can be included in ''.profile'' or the equivalent for your terminal of choice.<br />
## In the terminal set JAVA_HOME to the java home directory. </br>''/usr/libexec/java_home -V'' will list all known values for java_home.</br>If you have multiple copies of java, choose the version you want to us''e.<br />
## In the terminal set ANT_HOME to the location of ANT. e.g. ''/opt/ant''<br />
## In the terminal make sure that Ant and subversion are in your ${PATH} variable. e.g.''PATH=${PATH}:/usr/local/opt/subversion/bin:/usr/local/ant/bin''<br />
# 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)<br />
# Connect to the SVN server and download the source code for the KoLmafia Project.</br>''svn checkout <nowiki>svn://svn.code.sf.net/p/kolmafia/code/</nowiki> kolmafia''<br />
# Compile KoLmafia with Ant (''cd kolmafia && ant daily'') <br />
# execute KoLmafia with the command ''java -jar dist/KoLmafia-*.jar<br />
<br />
[[Category:Tech Support]]</div>HippoKing