We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,018 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Cannot find symbol class forName

Hi,
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.

3
Contributors
4
Replies
15 Minutes
Discussion Span
1 Year Ago
Last Updated
5
Views
Question
Answered
VeyRonX
Newbie Poster
2 posts since May 2012
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 0

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");

JamesCherrill
... trying to help
Moderator
8,516 posts since Apr 2008
Reputation Points: 2,583
Solved Threads: 1,455
Skill Endorsements: 30

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

NormR1
Posting Sage
Team Colleague
7,742 posts since Jun 2010
Reputation Points: 1,158
Solved Threads: 793
Skill Endorsements: 16

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

VeyRonX
Newbie Poster
2 posts since May 2012
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 0

OK. Please mark this "solved"
J

JamesCherrill
... trying to help
Moderator
8,516 posts since Apr 2008
Reputation Points: 2,583
Solved Threads: 1,455
Skill Endorsements: 30
Question Answered as of 1 Year Ago by JamesCherrill and NormR1

This question has already been solved: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page rendered in 0.0705 seconds using 2.7MB