I'm learning SedgeWick's 《algorithm4》and I often need to debug the code in the book. but I can't run or debug directly by IDE button because there have many example code need set args in command line like:
java -cp ../../algs4.jar RandomSeq.java 20 50 60
java -cp ../../algs4.jar BinarySearch.java tinyW.txt < tinyY.txt
I want to debug java class with command args but I have no idea how to make it.
Joachim Sauer
309k59 gold badges568 silver badges624 bronze badges
-
3You seem to be starting your Java application manually from the built-in Terminal in IntelliJ IDEA. This means you're not really using the Java capabilities of IDEA at all. You should instead launch it via a Run/debug configuration. There you can specify command line arguments if you like and then launch it either in "normal" mode or "debug" mode. If you just click "run" on a class, it will create a launch configuration for you that you can then edit to include the arguments that you want.Joachim Sauer– Joachim Sauer2021年05月29日 07:28:39 +00:00Commented May 29, 2021 at 7:28
-
Thanks,that solve my problem.Tracker647– Tracker6472021年05月29日 07:53:55 +00:00Commented May 29, 2021 at 7:53
1 Answer 1
Use Run/Debug Configuration for Java Application and specify a Main class and Program arguments in the Run Configuration dialog:
answered May 31, 2021 at 14:25
Andrey
16.8k27 gold badges106 silver badges210 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
lang-java