-
-
Notifications
You must be signed in to change notification settings - Fork 239
Windows Setup
In order to do development of NetLogo and NetLogo extensions on Windows 7/8/10, you'll need to have git
, sbt
and a Java 17 JDK installed. You'll also need some environment variables set correctly.
Steps for setting up Windows 7/8/10 for NetLogo and NetLogo extensions development:
The Scala Build Tool, abbreviated sbt, allows you to build NetLogo or NetLogo extensions. The Java JDK contains the Java compiler, javac.exe
, which turns NetLogo source code into code that Java can execute. Git is a utility for managing source code in local and remote repositories; it enables tracking changes to a code repository and sharing changes between users (in our case, through Github).
- Download and install
git
. https://git-scm.com/download/win - Download and install a Java JDK from Oracle (current desktop must use Java 8). http://www.oracle.com/technetwork/java/javase/downloads/index.html
- Download and install
sbt
. https://www.scala-sbt.org/download.html - Open a console
- Good console choices are PowerShell (usually pre-installed on Windows) or ConEmu. I do not recommend Git Bash or any other MinGW or Cygwin-based alternative, as you'll probably have path issues.
- Make sure
git
is available by runninggit --version
- you should see the version you installed. - Make sure
sbt
is available by runningsbt sbtVersion
- you should see the version you installed. - Make sure
java
andjavac
are available by runningjava -version
andjavac -version
- you should see the version you installed. If not, you'll need to update yourPATH
user environment variable to point to thebin
folder of your JDK install location (see below).
Environment variables are just simple settings that are available in your console, and also to programs that you run (like sbt).
To set a user's environment variable in Windows 7, right click on My Computer -> Properties -> Advanced -> Environment Variables. There you can add a New...
variable for JAVA_HOME
, JAVA_OPTS
and Edit...
the PATH
if you need to.
To set an environment variable in Windows 8 or 10 it should be the same steps. You can search for "Environment Variables" in the search bar to open the editor.
- Add a
JAVA_HOME
user environment variable to points to your JDK17 installation (not thebin
folder, the root of the install), as well.- If you see a "
native2ascii
not found" error when runningsbt
, this is probably the step you were missing. Note you have to close and re-open your console to get the new value. - In ConEmu or the Command Prompt, use
echo %JAVA_HOME%
to confirm it is set correctly, in PowerShell use$env:JAVA_HOME
.
- If you see a "
There are some extra settings that may be necessary in order for sbt and Java to compile NetLogo, increasing available memory and disabling some runtime features that slow compilation way down. The sbt.bat
file that comes with sbt will look for settings in the JAVA_OPTS
environment variable.
- Add a
JAVA_OPTS
user environment variable with a value of-Xmx2048M -Xss10M -XX:+UseParallelGC -Dfile.encoding=UTF-8 -Dsbt.log.format=true -Dsbt.io.jdktimestamps=true
- In ConEmu or the Command Prompt, use
echo %JAVA_OPTS%
to confirm it is set correctly, in PowerShell use$env:JAVA_OPTS
.
- In ConEmu or the Command Prompt, use
If you do not want to use these settings for all sbt
projects, you can instead setup your own batch file or PowerShell script to set this variable before running sbt.bat
for NetLogo development only.
You don't need to do the below if you are developing an extension, but it isn't a bad idea to have a local clone of NetLogo setup for easy extension testing. It will also confirm your development environment is ready to work.
- Open your console again.
- From the directory you want to store the NetLogo project, clone the NetLogo repository,
git clone https://github.com/NetLogo/NetLogo
. - Run
git submodule update
to make sure all of NetLogo's submodules are updated. - Now running
sbt.bat
in the NetLogo repository should get things started. - Once sbt is loaded, try running
all
. This is only necessary on a new clone/setup of NetLogo. - Once it's done, restart sbt (
exit
to exit), and then you can executenetlogo/run
to see if it can compile and run the NetLogo GUI (it'll take some time). If NetLogo starts up, congratulations, you're ready to go!
- Extensions
- NetLogo Libraries
- Controlling API
- Extensions API
- 6.0 Extension and Controlling API Transition-Guide
- Optimizing NetLogo Runs
- Setting English as the Default Language when Running NetLogo
- Unofficial Features
- Advanced Installation
- Optimization List
- Java System Properties and how to use them
- NetLogo on ARM Devices
- Multiple Views via HubNet
- Branches
- Building
- Tests
- Windows Setup
- Continuous Integration
- Draft: How to Help
- Google Summer of Code Ideas List
- Syntax Highlighting
- Building with IntelliJ
- Code Formatting
- Localization
- File (.nlogo) and Widget Format
- Benchmarking
- Releasing
- Preparing the Models Library for Release
- Documentation
- NetLogo Bundled Java Versions
- JOGL
- Plugins API
- Architecture
- LazyAgentset
- Model Runs and Review Tab
- Model Runs: To Do and Code Overview
- Notes on in Radius
- Archived Branches
- The nlogox format
- Touch API Proposal
- Why isn't NetLogo "Parallel"?
- Potential Speedups
- Tortoise
- SimServer, WebStart, and NetLogo in Classrooms