So I have been looking around and nothing worked so I thought I would come here, I am wondering how would I create a Batch file to set library path (Slick and LWJGL + natives) compile and finally run the code for my game
Asked
Active
Viewed 1,452 times
0
-
On which OS you plan to run your java app? – akhikhl Jan 02 '14 at 01:33
-
I plan to run it on windows – user3150675 Jan 02 '14 at 01:35
-
1You should probably keep "compile" and "run" as two separate operations. – Elliott Frisch Jan 02 '14 at 01:36
-
I know somewhat how to run and compile it but its more adding the libraries – user3150675 Jan 02 '14 at 01:38
-
possible duplicate of [Including jar files in class path](http://stackoverflow.com/questions/8084926/including-jar-files-in-class-path) – Robin Green Jan 11 '14 at 10:29
-
also, this is a really bad question so I am downvoting it. You should post in your question (a) what you tried (or just give links and say why they didn't work, that's better than nothing), and (b) what you are actually having trouble with, i.e. adding the libraries. – Robin Green Jan 11 '14 at 10:31
1 Answers
4
If your app must run on Windows, do the following:
1) create .bat file with the following content:
@java -Dfile.encoding=UTF8 -Xms512m -Xmx1024m -cp "%~dp0\lib\*" mypackage.MyClass %*
2) copy all jars (dependencies and main jar) to "lib" subfolder.
3) run .bat file.
Trivia:
-Dfile.encoding=UTF8 guarantees the same encoding for file read/write operations and for string/bytearray conversions, independently on the OS settings.
-Xms512m - defines minimum memory allocated for java application.
-Xmx1024m - defines maximum memory allocated for java application (it should not exceed physical memory of the target machine, otherwise the program would not start).
mypackage.MyClass should be substituted with a qualified name of the class containing main function.

akhikhl
- 2,552
- 18
- 23
-
-
a qualified name of the class containing main function. "qualified" means that the name includes package name and class name, dot-separated. – akhikhl Jan 02 '14 at 01:52
-