The Undefeated Posted May 2, 2017 Share Posted May 2, 2017 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? Quote Link to comment Share on other sites More sharing options...
Explv Posted May 2, 2017 Share Posted May 2, 2017 (edited) 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, 2017 by Explv Quote Link to comment Share on other sites More sharing options...
The Undefeated Posted May 2, 2017 Author Share Posted May 2, 2017 (edited) 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, 2017 by The Undefeated Quote Link to comment Share on other sites More sharing options...
Explv Posted May 2, 2017 Share Posted May 2, 2017 (edited) 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, 2017 by Explv Quote Link to comment Share on other sites More sharing options...
TJ2017 Posted May 2, 2017 Share Posted May 2, 2017 nicely put i've always liked your scripts and such Quote Link to comment Share on other sites More sharing options...
The Undefeated Posted May 2, 2017 Author Share Posted May 2, 2017 (edited) 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, 2017 by The Undefeated Quote Link to comment Share on other sites More sharing options...
Explv Posted May 2, 2017 Share Posted May 2, 2017 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"}; Quote Link to comment Share on other sites More sharing options...
The Undefeated Posted May 2, 2017 Author Share Posted May 2, 2017 (edited) 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, 2017 by The Undefeated Quote Link to comment Share on other sites More sharing options...
LoudPacks Posted May 2, 2017 Share Posted May 2, 2017 (edited) https://pastebin.com/7L5WDubc Had to pastebin it because OSBot cloudflare was blocking me from posting the code Edited May 2, 2017 by LoudPacks Quote Link to comment Share on other sites More sharing options...
The Undefeated Posted May 3, 2017 Author Share Posted May 3, 2017 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. Quote Link to comment Share on other sites More sharing options...
LoudPacks Posted May 3, 2017 Share Posted May 3, 2017 (edited) 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, 2017 by LoudPacks Quote Link to comment Share on other sites More sharing options...
The Undefeated Posted May 3, 2017 Author Share Posted May 3, 2017 (edited) 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, 2017 by The Undefeated Quote Link to comment Share on other sites More sharing options...
Explv Posted May 3, 2017 Share Posted May 3, 2017 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\""}; Quote Link to comment Share on other sites More sharing options...