Uploading a bot that imports a library (Java)


#1

How would one upload a bot that imports a library? I currently have a Java bot. It imports some classes from a library in a jar file, and when I compile/run it locally, I include the libraries in the classpath, but It doesn’t seem like I can do that on the server. I’ve thought about compiling it with an install.sh, but it would still need the classpath to run the bot (and maybe the compiling script would overwrite the one compiled by install.sh? not sure.) I tried uploading the bot as is, and it would get stuck compiling, neither succeeding nor failing.
Would there be some alternative way to import a library in Java, or some way to compile/run it on the server using the classpath?


#2

You can try building an executable fat jar and uploading it instead of source code.


#3

Yes this is what I do; I create a fat jar which includes all my dependencies. I think they mentioned how you submit jar files here.

As far as the best way to do this, i have my project set up with Maven and I use the maven shade plugin to do this work for me in one step via mvn package.