zanko360 1 Share Posted April 9, 2019 Hello, When I import an external .jar with some variables and code, then I try to use it in my script and all compiles without errors when I run it it does nothing. If I put it in onLoop() the scripts starts but does nothing, if I put it in class scope or in another class then the script doesnt start at all. What am I doing wrong? Is it even possible for me to create a library with some dreambot functionality and export it in .jar for later importing and reuse in multiple scripts? Thank you. Link to comment Share on other sites More sharing options...
yeeter 491 Share Posted April 9, 2019 Did you check if the build path was configured correctly, and that the external .jar file you are trying to use exported correctly to begin with? Not sure the specifics of the .jar you are trying to use but could you attempt using it in a non DreamBot script and see if you could get it working there? Link to comment Share on other sites More sharing options...
zanko360 1 Author Share Posted April 9, 2019 I have tried with the same .jar in a eclipse created java application and worked fine. It is exported correctly I opened it with winrar and the package folder is there and inside is the right .class file. The jar cointains 1 class that is in a package and the class contains a public static String variable that I tried to print out in the script class inside onLoop() by directly accessing (Library.string) that didn't work. So I tried to create an instance of the class in onLoop() then accessing the variable from that instance, also didnt work, finally I tried to create a another class in the script's .java file that has a String which gets its content from Library.string and then creating an instance of it in onLoop() also doesnt work. The same happend when I tried it with an integer value. All of this works if its a regular java app created in eclipse. I exported it to .jar with and added it as the script's projects external dependancy like so: http://prntscr.com/n9lncm . I am trying to figure out how to save my scripts methods in classes and export them to .jar in a library fashion so I can reuse them later in different scripts. Have googled on importing, java file types, dependancies and I can't find an error in my way. Is this how dreambot works? Will try exporting my code to regular .java files and then manually add them to script project's package and see if that works. Thanks for reply Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now