Ultimate Java Part 2 code not runnable

I downloaded the code for the Mortgage Calculator for part 2 but when I attempt to run the main.java I get an error “The file in the editor is not runnable.” There run arrow is grey.

I assume you mean the one in this zip file at Code/Section 3-Refactoring/Start/Mortgage Calculator/Main.java, correct?

I copied and pasted the code exactly as written into a Java REPL and it runs just fine. Have you run Java files before in your editor? Maybe share a screenshot of your editor?

1 Like

Hi Jason, Thank you for your quick response.

Yes, that is the zip file. While I have done several tutorials and several projects in a boot camp, I am still new to Java. I have tried to open it many ways, so I am not sure what exactly to show you because I have tried to open it so many different ways that I have just deleted everything. I cannot figure out how to open it properly. Every time, no matter what I do, the run button that is usually green for me in everything else I have ever done is greyed out.

I cannot see his file tree in any of the videos. I simply have no idea how to open this and get it to run. I am back to square 1. I have downloaded the zip file. But I do not know what do after that because clearly what I am doing is not it.

Once you extract the contents of the zip file there should be a number of folders (aka directories) inside. About one per section of the course as far as I remember when I opened it the other day. Are you using VSCode?

1 Like

I got it to work! Before now I have gotten all my materials from github. I have no idea what was happening, but it is working now.

Thank you

1 Like

Hi @alacrity and @jmrunkle ! I’ve encountered the same problem with the source code. May I know how you had solved the issue? When I open the downloaded source code file, it looks like this:

And I definitely don’t see the file tree in the course video either. Nor can I run the code. :frowning:

Hi, I used to have this issue, it is because you need to manually point the IDE to the libraries that the code is built on. Sometimes asking the IDE to build and compile the code before execution works, but I recommend modifying the run configuration and manually telling the IDE where did you store the files/libraries for this code to work.

1 Like

Thank you @King_Sardius ! May I know how to modify the run configuration and manually tell the IDE where the code is stored? I am totally new to Java and am very confused. I really wish the instructor had taught about this in the course.

What IDE do you use? so it seems you’re still having this issue. Have you stopped coding because of this?

1 Like

If you are using IntelliJ IDE, check these menus next to your “Run” button, and the “MainPayment/s” configurations are just what I named them. You will need to name your configurations.

Confugutations Options

1 Like

Here is another solution from “Paul” in StockOverflow.
(IntelliJ IDEA is not recognizing my java files as runnable and instead wants to run the class files. Any ideas of how to fix? - Stack Overflow)

1 Like

Thank you for your patient explanation, @King_Sardius ! I have followed your steps (and Paul’s from your StackOverflow screenshot) but encountered a new problem – now the program can run but immediately fails, as in the screenshot below:

I feel so hopelessly stupid now. :dizzy_face: I have managed to establish a theoretical understanding of the stuff taught in the course, but not being able to get hands-on practice due to technical problems like these is really frustrating…

I haven’t! But I might turn to a different course before I totally lose interest in it… we get so little support from the instructor here. :cry:

You are doing everything correctly now. You are literally one step from running your code. Try a different build, SDK. Version 20 gives me problems most of the time too. So choose IntelliJ SDK, which I think its v19, or v17. Simply choose another SDK and you’ll be set. Great job on understanding the steps and your IDE.