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?

0

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?

0

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.

0

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

0

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.

0

Okay, they're uploaded as

idea-logs-knute.zip
0

These are the logs, please share the project as well.

0

Okay, they're uploaded as idea-project-knute.zip

0

Try creating Inputer.iml file in the project root directory with the following contents:

<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
0

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. 

0

Not sure what has caused the problem. The module was missing for some reason. Creating a new module solved the problem:

0

请先登录再写评论。