This is the line: Class ourClass = new Class.forName("com.app.something");

And this is the the error: cannot find symbol class forName

My IDE is Intellij Idea.

This is a particular case, but i want to know what causes this type of error, what should i look for.

Recommended Answers

All 4 Replies

The keyword "new" is wrong here. You are just calling the static method "forName" in the Class class. It's not a constructor.
Class ourClass = Class.forName("com.app.something");

**new **may be confusing the compiler to look for a constructor.

Yes indeed, thank you, sometime you miss those details.

OK. Please mark this "solved"

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.