Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: Module not specified (IntelliJ IDEA)

I was trying to execute a simple program in IntelliJ IDEA as a static web project. I'm newbie and I'm learning web development with Node.js. I took help from the official website of IntelliJ IDEA, but the error was same. Though, I configured the settings and Project structure also.

Error:

"C:\Program Files\Java\jdk1.8.0_91\bin\java" -Didea.launcher.port=7535 "-Didea.launcher.bin.path=C:\Program Files\JetBrains\IntelliJ IDEA 2016.1.2\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files\JetBrains\IntelliJ IDEA 2016.1.2\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMain ""
Exception in thread "main" java.lang.ClassNotFoundException: 
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:264)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:122)

Process finished with exit code 1

Snapshot of IDE

Please help me to sort out this problem. I'm digging out this problem since few days.

like image 476
thedebuggger Avatar asked Jun 24 '16 16:06

thedebuggger


People also ask

How do I specify a module in IntelliJ?

Select the top-level directory in the Project tool window and press Alt+Insert or select New | Module from the context menu. The New Module wizard opens. From the list on the left, select a module type. Name the new module.

Where is module settings in IntelliJ?

From the main menu, select File | Project Structure Ctrl+Alt+Shift+S . Under Project Settings, select Modules | Sources.


3 Answers

This is because the className value which you are passing as argument for
forName(String className) method is not found or doesn't exists, or you a re passing the wrong value as the class name. Here is also a link which could help you.

1. https://docs.oracle.com/javase/7/docs/api/java/lang/ClassNotFoundException.html
2. https://docs.oracle.com/javase/7/docs/api/java/lang/Class.html#forName(java.lang.String)

Update

Module not specified

According to the snapshot you have provided this problem is because you have not determined the app module of your project, so I suggest you to choose the app module from configuration. For example:

enter image description here

like image 187
Elham Kohestani Avatar answered Oct 14 '22 07:10

Elham Kohestani


this is how I fix this issue
1.open my project structure

2.click module enter image description here 3.click plus button enter image description here 4.click import module,and find the module's pom enter image description here
5.make sure you select the module you want to import,then next next finish:) enter image description here

like image 27
Hanz Avatar answered Oct 14 '22 05:10

Hanz


For IntelliJ IDEA 2019.3.4 (Ultimate Edition), the following worked for me:

  1. Find the Environment variables for your project.
  2. Specify, from the dropdowns, the values of "Use class path of module:" and "JRE" as in the attached screenshot.

enter image description here

like image 2
tonderaimuchada Avatar answered Oct 14 '22 05:10

tonderaimuchada