Beta8397 / virtual_robot

A 2D robot simulator to help beginners learn Java programming for FTC Robotics
100 stars 171 forks source link

Unable to run program (no configuration) #47

Closed LJA-Robotics closed 3 years ago

LJA-Robotics commented 3 years ago

Hello! I have followed the steps in the readme file as well as on the video tutorial. I have downloaded the JDK, IntelliJ, and the project folder. I imported the project, but I am unable to run the program. The 'run' button which is usually a green play button is grey. I believe it is because there is no configuration. I can see this in the drop-down menu next to the run button where it says 'edit configurations'. I'm not sure where to go from here.

Thanks!

jkenney2 commented 3 years ago

Hi, try this:

  1. Use that drop-down menu and select "edit configurations" to open the Run/Debug Configurations dialog.

  2. At the upper left of the dialog, click "+", then click "Application".

  3. Click the "..." button next to the "Main Class" text box and select "VirtualRobotApplication", then click "OK". The text box should now say: virtual_robot.controller.VirtualRobotApplication

  4. The "Working Directory" textbox should contain the path to the main directory of the project. For example, on my system it is: C:\Users\JimLori\IdeaProjects\virtual_robot.

  5. For the "Use Classpath or Module" drop-down, select "Controller".

  6. The "JRE" box should say: "Default" (with some other text next to it that is grayed out).

  7. If you like, you can change "Name", to something other than "Unnamed"

  8. Click "Apply", then "OK" to close the dialog.

  9. Your new run configuration should now be available in the drop-down next to the "run" arrowhead. If it is not already selected, select it. The run arrowhead should now be green, and you can run the program.

jkenney2 commented 3 years ago

Please let me know whether the above works or not.

Also, are you using a recently-downloaded version of the project? I had this issue early on, but thought that at this point the appropriate run configuration was coming automatically in the stored repository.

jkenney2 commented 3 years ago

One other thought:

If you obtained the project by downloading then extracting a zip, and if you accepted the default directory for extracting the zip, you would wind up with a directory structure that looks something like this:

C:\Users\Me\Downloads\virtual_robot-master\virtual_robot-master

When you open the project in IntelliJ, you want to select the most deeply nested virtual_robot-master folder. If you select the outer virtual_robot-master folder, IntelliJ will open it (and you won't get an error message), but it won't work, and you won't have a run configuration.

LJA-Robotics commented 3 years ago

I tried the first solution you sent, it created the configuration and the green run button was there, but when pressing it nothing happened. I did extract the zip to my desktop and when importing the project I selected the most deeply nested virtual_robot-master folder. I downloaded the zip from GitHub which I assume has the most recent version.

jkenney2 commented 3 years ago

Wondering if there's a way you can share your copy of the project in its current state so I can look at it. Since you downloaded as a zip (as opposed to cloning with the git app), it would take a little work for you to put it in a github repository, and some experience using git. Instead, you could copy it to a new folder on google drive, get a shareable link to that folder only, and send that link via the email address on our github page. Or, you could start by just sharing your run configuration. You'd need to do "Edit Configurations...", and check the box labeled "Share" next to the name of your run config. Then click "Apply" then "OK". In the project file structure you'll then find a folder called .idea\runConfigurations, and it will contain a .xml file containing your run configuration. You could send that by email and I could start by looking at it.

alan412 commented 3 years ago

@LJA-Robotics : I have seen it in Android Studio where you have to do a build first before you can run the first time. Perhaps this is setting some variable up.