spigot run command as console

Java
ConsoleCommandSender console = Bukkit.getServer().getConsoleSender();
String command = "/command";
Bukkit.dispatchCommand(console, command);
Source

Also in Java: