Cannot get simple command line project to compile or run
已回答
I am on Ubuntu 20.04, IntelliJ 2020.1.1 Community
I am trying to build/compile/run a simple command line application. I imported the project from GitHub. I have tried Build Project, Rebuild Project, and editing the Run Configuration to no avail. No .class files are in the project. No "out" directory is created. Any ideas?
请先登录再写评论。
Please see https://stackoverflow.com/a/42660624/104891.
The last item is likely the case: https://youtrack.jetbrains.com/issue/IDEA-184561.
I closed and reopened my project (called Inputer) and IDEA gave me an event log saying that it could not load Inputer.iml. Indeed, that file does not exist. How do I fix this?
Please check the modules configuration, there should be a Java module with the content and source roots.
If the module doesn't exist or is not valid, create a new one: https://www.jetbrains.com/help/idea/creating-and-managing-modules.html#add-new-module . Then configure the roots: https://www.jetbrains.com/help/idea/configuring-content-roots.html .
If it's a Maven or Gradle project import it from pom.xml/build.gradle instead.
I have done the above and everything else I can think of. There is still no "out" folder, no .class files in the project, and of course, I cannot run the project.
/usr/lib/jvm/java-11-openjdk-amd64/bin/java -javaagent:/home/knute/idea/idea-IC-192.6603.28/lib/idea_rt.jar=41061:/home/knute/idea/idea-IC-192.6603.28/bin -Dfile.encoding=UTF-8 net.snortum.inputer.InputerPlay
Error: Could not find or load main class net.snortum.inputer.InputerPlay
Caused by: java.lang.ClassNotFoundException: net.snortum.inputer.InputerPlay
Process finished with exit code 1
Please share the sample project and the logs (Help | Collect Logs and Diagnostic Data), zip and upload the file at https://uploads.services.jetbrains.com/ and provide the name here.
Okay, they're uploaded as
These are the logs, please share the project as well.
Okay, they're uploaded as idea-project-knute.zip
Try creating Inputer.iml file in the project root directory with the following contents:
That did it, thanks!
Do you know what I did wrong, if anything? I'm planning on importing several projects from git repos and I want to do it correctly.
Not sure what has caused the problem. The module was missing for some reason. Creating a new module solved the problem: