vscode不使用maven等工具手动导入jar包
步骤
- 下载相应的jar包
- 加入Referenced Libraries中
比如下面日志用了Commons Logging(一个第三方日志库)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| package base;
import java.util.logging.Logger; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory;
public class Logging { public static void main(String[] args) {
Logger logger = Logger.getGlobal(); logger.info("start process..."); logger.warning("memory is running out..."); logger.fine("ignored."); logger.severe("process will be terminated...");
Log log = LogFactory.getLog(Logging.class); log.info("start..."); log.warn("end."); } }
|
安装了”Extension Pack for Java(一组插件)”后左下角有Java项目栏,在”Referenced Libraries”添加jar就能使用了,如图
参考