May 2, 20178 yr I use this code to start the bot in a java application: String completeCLI = "java -jar \"root/Desktop/osbot.jar\""; System.out.println(completeCLI); Process proc = Runtime.getRuntime().exec(completeCLI); proc.waitFor(); This works in Windows, but not in Ubuntu. Anyone knows how I can start my client in Ubuntu?
May 2, 20178 yr 11 minutes ago, The Undefeated said: I use this code to start the bot in a java application: String completeCLI = "java -jar \"root/Desktop/osbot.jar\""; System.out.println(completeCLI); Process proc = Runtime.getRuntime().exec(completeCLI); proc.waitFor(); This works in Windows, but not in Ubuntu. Anyone knows how I can start my client in Ubuntu? Tested and seems to work: ProcessBuilder processBuilder = new ProcessBuilder("java", "-jar", "/home/user/explv/Downloads/OSBot 2.4.121.jar"); processBuilder.start(); Edited May 2, 20178 yr by Explv
May 2, 20178 yr Author 14 minutes ago, Explv said: Tested and seems to work: ProcessBuilder processBuilder = new ProcessBuilder("java", "-jar", "/home/user/explv/Downloads/OSBot 2.4.121.jar"); processBuilder.start(); But how can I add CLI parameters to it now? Can't figure that out. ProcessBuilder doesn't allow a 3rd argument. Edited May 2, 20178 yr by The Undefeated
May 2, 20178 yr 16 minutes ago, The Undefeated said: But how can I add CLI parameters to it now? Can't figure that out. ProcessBuilder doesn't allow a 3rd argument. The ProcessBuilder constructor accepts either a List<String> or String... Each item in the List or String[] is one parameter of the command. So, for example: List<String> command = new ArrayList<>(); Collections.addAll(command, "java", "-jar", "/path/to/osbot.jar", "-script", "890:none"); ProcessBuilder pBuilder = new ProcessBuilder(command); or String[] command = {"java", "-jar", "/path/to/osbot.jar", "-script", "890:none"}; ProcessBuilder pBuilder = new ProcessBuilder(command); or ProcessBuilder pBuilder = new ProcessBuilder("java", "-jar", "/path/to/osbot.jar", "-script", "890:none"); Edited May 2, 20178 yr by Explv
May 2, 20178 yr Author 33 minutes ago, Explv said: The ProcessBuilder constructor accepts either a List<String> or String... Each item in the List or String[] is one parameter of the command. So, for example: List<String> command = new ArrayList<>(); Collections.addAll(command, "java", "-jar", "/path/to/osbot.jar", "-script", "890:none"); ProcessBuilder pBuilder = new ProcessBuilder(command); or String[] command = {"java", "-jar", "/path/to/osbot.jar", "-script", "890:none"}; ProcessBuilder pBuilder = new ProcessBuilder(command); or ProcessBuilder pBuilder = new ProcessBuilder("java", "-jar", "/path/to/osbot.jar", "-script", "890:none"); This only starts the bot and doesn't log it in. String[] command = {"java","-jar","osbot.jar","-login \"The Undefeated\":password"}; ProcessBuilder pBuilder = new ProcessBuilder(command); pBuilder.start(); Edited May 2, 20178 yr by The Undefeated
May 2, 20178 yr 20 minutes ago, The Undefeated said: This only starts the bot and doesn't log it in. String[] command = {"java","-jar","osbot.jar","-login \"The Undefeated\":password"}; ProcessBuilder pBuilder = new ProcessBuilder(command); pBuilder.start(); "-login" and "username:password" should be two separate items in the array: String[] command = {"java","-jar","osbot.jar","-login", "\"The Undefeated\":password"};
May 2, 20178 yr Author 8 minutes ago, Explv said: "-login" and "username:password" should be two separate items in the array: String[] command = {"java","-jar","osbot.jar","-login", "\"The Undefeated\":password"}; Forgot to mention I already tested that and didn't even start, might be caused by the space in my name. Even tried it like this but won't start either. String[] command = {"java","-jar","osbot.jar","-login", "\"The", "Undefeated\":password"}; Edited May 2, 20178 yr by The Undefeated
May 2, 20178 yr https://pastebin.com/7L5WDubc Had to pastebin it because OSBot cloudflare was blocking me from posting the code Edited May 2, 20178 yr by LoudPacks
May 3, 20178 yr Author 1 hour ago, LoudPacks said: https://pastebin.com/7L5WDubc Had to pastebin it because OSBot cloudflare was blocking me from posting the code Shows the exact same behavior as I stated in my comment above.
May 3, 20178 yr 33 minutes ago, The Undefeated said: Shows the exact same behavior as I stated in my comment above. Oh sorry I thought you knew. You need your own login handler since all randoms are disabled, or if your using non-cli paramters and just using this to start simple scripts then you can remove the -norandoms flag in my code. If you end up using the custom login handler, you will need to pass the bot login info as parameters since you cant access those hidden fields normally. You can make your own or I think Explv may have a snippet of some somewhere on here. Edited May 3, 20178 yr by LoudPacks
May 3, 20178 yr Author 10 hours ago, LoudPacks said: Oh sorry I thought you knew. You need your own login handler since all randoms are disabled, or if your using non-cli paramters and just using this to start simple scripts then you can remove the -norandoms flag in my code. If you end up using the custom login handler, you will need to pass the bot login info as parameters since you cant access those hidden fields normally. You can make your own or I think Explv may have a snippet of some somewhere on here. If you read my post above I said the whole client doesn't even start. I know what norandoms does and I have my own login handler but those make no sense if I can't even open the client. EDIT: Got it working by putting my username in quotation marks. Edited May 3, 20178 yr by The Undefeated
May 3, 20178 yr 13 hours ago, The Undefeated said: Forgot to mention I already tested that and didn't even start, might be caused by the space in my name. Even tried it like this but won't start either. String[] command = {"java","-jar","osbot.jar","-login", "\"The", "Undefeated\":password"}; Try: String[] command = {"java", "-jar", "osbot.jar", "-login", "\"\\\"The Undefeated\\\":password\""};
Create an account or sign in to comment