简体   繁体   中英

Can't import java.lang.reflect in maven project?

I'm trying to import java.lang.reflect in a java file of a maven project, but I get "error cannot find symbol" on the import line. It can't find java.lang either. This is a built in Java lib, right? I didn't think I needed to add any dependencies for a default java lib. Is there a certain dependency I need to define to gain access to this lib?

Are you importing a fully classfied class name or just the package?

The folowing is a valid statement:

import java.lang.reflect.*;

While import java.lang.reflect would try to find a class 'reflect' in package java.lang resulting in "cannot find symbol"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM