0

I am trying to get my head around passing information from one Controller to another and back again. I watched a couple of youtube videos and found one that helped. I then downloaded his sample project from Github (https://github.com/JaretWright/GUIDemo) but I am having trouble running the project. I am using IntelliJ CE.

When I open up the "Run" menu I get the run option shown in the image below:

Run menu

IntelliJ then presents me with the option to "Edit Configurations" as shown in the image below:

Edit Configurations

When I click on that I get the following screen:

enter image description here

I select "Application" because i am sure that it is none of the other options. I then try and set the "Main" class IntelliJ prompts me to either search by name or by project. When I select to search by name I get the following options (from which I am unsure as to which to select):

enter image description here

And when I select to search by project IntelliJ will not allow me to select the class file that I know contains the "main" method as shown in the image below:

enter image description here

I don't know what to do, and I have scoured the net for some answers but I find nothing I can get to grips with. The folder structure for the project is shown in the image below:

enter image description here

I have also noticed that the class files do not appear as they would if I had created the project from scratch. On the ".java" files the icon shows a "J" in a red disc as shown below:

enter image description here

Instead of the usual "C" in a blue disc as shown below:

enter image description here

Can someone please help, or point me in the direction of some help.

Thanks in advance of any help offered.

Yastafari
  • 81
  • 6

2 Answers2

1

Just to make note, this project seems to be using older build technology called ant. I am not sure if this has any impact on Intellij as I have not used ant with CE version.

I am wondering if you have setup your Project SDK correctly within Intellij.

If you can open up your Project Structure window (shown below), you should see your Project SDK defined. enter image description here

My hope is that you do not have an SDK defined and that is why your icons are the orange j instead of the usual blue C. If it is not defined this should hopefully allow things to fall into place and for Intellij to recognize your main class (assuming CE version has ant support which I am not sure).

Loading...
  • 121
  • 4
  • I had another look through and could not see a reference to "ant".Can you point me to where you saw that referenced please. – Yastafari Jan 17 '20 at 00:37
  • The `build.xml` file is usually consumed by ant – Loading... Jan 18 '20 at 01:14
  • Ah! I see. Thanks for the tip. Will keep that in mind in the future. Are there any references on the net I can go to read up about "ant" that you would recommend. – Yastafari Jan 18 '20 at 13:27
1

IntelliJ does not recognize the folder your class files are in as java sources. Right click on the "src" folder then "Mark directory as" and finally sources root.

enter image description here

Then IntelliJ should treat them as classes and build your project. Then either open the class containing your main-method and press the green play button next to the main method to run it.

enter image description here

Alternatively, you can right click on the class and then click "Run ${Application}.main().

enter image description here

And finally this should also enable you to setup a run configuration as described in your original question by now finding the GUIDemo class as main class.

enter image description here

Note that project SDK needs to be setup as described in @Loading...'s answer.

Hope that helps and enjoy IntelliJ.

meaningqo
  • 1,653
  • 10
  • 16