Hi,
I'm having a problem with intelliJ plug-in. I usually use the run function in intelliJ and test the solutions before I evaluate with the plug-in. But after a few exercises the run function doesn't run the exercise I'm working on but one of the previous ones. I'm guessing because all the main solution classes named solution.main(). Do I have to delete a cache somewhere or is there anything I could do?
The only way I found is to remove the CodeGymTasks folder and download it again.. It's time consuming and frustrating.. Anyone else is having this problem?
I'm on ubuntu 20.04. I don't think its OS related tho... Any help is greatly appreciated.. Thanks
Seferi
Level 22
IntelliJ run function problem
Comments (12)
- Popular
- New
- Old
You must be signed in to leave a comment
hidden #10716042
20 April 2021, 22:43
One surefire solution is to delete the CodeGym folder that holds that particular program task that keeps reappearing, then Edit the Configuration in the Solution dropdown to the correct Java SDK, the correct CodeGym module and task number, rename the Solution title and Save the configuration. This has worked consistently for me.
0
Paul Chapelhow
4 October 2020, 14:44
I had to 'Edit Configuration' in the Solution dropdown - next to the green icons. I then changed the Main Class to the task I am working on - rather than the very first task I ran, which it seems to remember. Seems the plugin does not update all things when you choose a new task?
0
Brad Reed
13 July 2020, 19:26
commenting to track this, cuz Ive had the same issue.
0
Regina Support Team at CodeGym
6 July 2020, 08:59
Hi!
Try to click on the green triangle on the left side of the main class of your solution.
0
Seferi
6 July 2020, 09:08
Thats how I usually run my code. After a few exercises it runs the wrong exercise..
0
Regina Support Team at CodeGym
6 July 2020, 09:49
Why do we run one code class, and IJ Idea points out the errors in the other one?
The program is a project. In our case, the project is called CodeGymTasks. The program can be structurally divided into independent modules. In our case, these modules are quests (1. JavaSyntax, 2. JavaCore, 3. JavaMultithreading, 4. JavaCollections).
When launching a class in the task, that is ANY component of our Program or its separate module, all code (in our case, a module, a specific quest) is checked for the errors by the compiler.
If there is an unsolved task that does not compile (i.e. the necessary curly brackets are missing, there is no return method and other errors that are underlined with red), we will not be able to run other classes of this project/module.
Therefore, it is impossible to leave classes / tasks in an uncompiled state within a specific module/project.
So, there are a few ways how to make the required task compiled without compiling the other code solutions from previous tasks.
1. Mark all used tasks as excluded. To do this, left-click on the used task and select Mark Directory as -> excluded in the drop-down menu. The task#### folder will turn orange.
2. Comment out the problematic code in the previous tasks in order to the code in the required task would compile and wouldn't interfere with other tasks. How to do it? Select the problematic piece of code of the previous task and press CTRL + /. When you return to this task, then simply remove it from the comments.
3. Press CTRL + SHIFT + F10 when the cursor is active in the window with the required task code.
+4
Seferi
7 July 2020, 11:11
Thanks for the reply. I accidently marked excluded the exercise I was working on.. Now it opens the exercise with the wrong content.. I removed the CodeGymTask folder, downloaded through the plug-in again, it didn't help.. :(
0
Regina Support Team at CodeGym
7 July 2020, 14:07
Why don't you cancel the exclusion for those exercises?
+3
Seferi
7 July 2020, 19:16
Great explenation! Thanks!
+1
Jonaskinny Java Developer at Sandmedia
1 February 2022, 20:52
Seems this is still an issue. Simplest solution is to drop the plugin and go back to the web. Its essentially a web view inside the IDE from what I can tell. The package/quest/compilation order stuff are good reasons to implement it this way, it just does not work seamlessly and sadly its just easier for us to not use the plugin. If there is an update to Regina's July 7 2020 comment I'd take a look, otherwise it is likely best to just run in the IDE then validate on the website.
0
Regina Support Team at CodeGym
7 February 2022, 15:40
Hi!
Are you facing the issues alike?
1. Press CTRL + SHIFT + F10, when the cursor is active in the tab with the required task code.
2. On the left next to the Main method in the Solution tab of the required task, where the number of lines is indicated, you need to click on the green triangle and choose the upper option which is called like ClassName.main, i.e. ("Run Solution.main CTRL+SHIFT+F10").
3. In the Solution tab of the required task, please, click on the right button on the mouse. Then choose menu option "Run ClassName.main", i.e "Run Solution.main CTRL+SHIFT+F10"). If all of the above does not work, you can resort to more drastic measures:
If all of the above does not work, you can resort to more drastic measures:
1. Mark all used tasks as excluded. To do this, left-click on the used task and select Mark Directory as -> excluded in the drop-down menu. The task#### folder will turn orange.
2. If the method is not implemented but should return something, put stubs (return 1, return "", return new HashMap<>());
3. Comment out the problematic code in the previous tasks in order for the code in the required task would compile and wouldn't interfere with other tasks. How to do it? Select the problematic piece of code of the previous task and press CTRL + /. When you return to this task, then simply remove it from the comments.
+2
Jonaskinny Java Developer at Sandmedia
15 February 2022, 02:50
Hey Regina, thanks very much for that solution! I just noticed the notification now. Your first step was all I needed, since I always compile before debugging (command-line habit) I did not realize Intellij creates the needed config for the class with main() using java file in focus [en.codegym.task.jdkxx.taskxx.taskxxxx.Solution]. So CTRL+SHFT+F10 == create Run/Debug Configuration, then Run -Debug. So as long as you at least debug first once, you will have the needed entry in the Run Config Drop-down : top-middle left of the run >
0