I’m in the early stages of developing an IntelliJ plugin and need to execute a command in the IntelliJ terminal. I’m using JBTerminalWidget, which provides the executeCommand method for running commands, but it’s protected. Since I’m working with IntelliJ Community Edition, is there an alternative way to execute a command in the terminal?
Please use org.jetbrains.plugins.terminal.ShellTerminalWidget.executeCommand(shellCommand). So, you need to cast JBTerminalWidget to ShellTerminalWidget.
which includes the method TerminalShellCommandHandler.executeShellCommandHandler(...). However, I can’t seem to access org.jetbrains.plugins.terminal.ShellTerminalWidget.executeCommand(shellCommand) in my current setup.
Should I switch to a different version of the IntelliJ SDK or update my dependencies? I’m encountering an issue where certain commands aren’t executing as expected—for example, mvn commands run correctly, but npm commands are not being handled.
Any advice on resolving these limitations or which version to use would be greatly appreciated!
Thank you for your response. My primary objective is to execute a terminal command directly within the user’s IDE—specifically, opening the Run or Terminal prompt inside the IDE (not in an external window) and executing the command there. Is this kind of action supported? If so, do you have any sample code that demonstrates how to achieve it?