compiling from windows command line
nickdesaulniers opened this issue · comments
Hi there, I'm having a hard time trying to figure out how to compile+run the simple examples from:
https://www.lwjgl.org/guide and https://github.com/SilverTiger/lwjgl3-tutorial/wiki/Setup#test-your-setup
After downloading lwjgl and extracting the jar files, it looks like I can compile TestSetup with:
javac -classpath C:\Users\Nick\Downloads\lwjgl\jar TestSetup.java
I can't seem to figure out how to run the code. I think it would be worthwhile to clarify this in the documentation on:
https://github.com/SilverTiger/lwjgl3-tutorial/wiki/Setup
since it only discusses setting up an IDE.
For context, this is my first time revisiting Java since college.
The project uses Ant with Ivy, which you can get here and here.
After setting up Ant and Ivy you should go to the project root directoy and call ant update
in the console to automatically download the right LWJGL3 library and its native binaries.
After that you can just call ant run
and it should open the example game.
Is Ant a requirement? Can the docs be updated to say you must download+use ant
to use lwjgl?
Well it isn't a requirement, but it will simplify compiling the code, alternatively you could also use Maven or Gradle as Build Tool.
Of course you could also compile it manually by calling javac -d <path to build directory> -cp <path to lwjgl.jar> <source files>
in the root directory.
For example in this project you would call javac -d build/ -cp lib/lwjgl.jar src/silvertiger/tutorial/lwjgl/*.java src/silvertiger/tutorial/lwjgl/**/*.java
for compiling.
After that you can run it with java -cp <path to build directory>:<path to lwjgl.jar>:<path to native jar> <main class>
.
In the example project it is java -cp build/:lib/lwjgl.jar:lib/lwjgl-platform-natives-windows.jar silvertiger.tutorial.lwjgl.Main
.
I'll close this issue since I added an appendix to the setup page for building from command line.
thanks! 🍻