package com.test.chin;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
import org.junit.Test;
public class packetResTest {
public static void main(String[] args) {
}
@Test
public void getLoginInfo(){
ClassLoader classLoader = this.getClass().getClassLoader();
InputStream is = classLoader.getResourceAsStream("com\\test\\chin\\login.properties");
Properties proObj = new Properties();
try {
proObj.load(is);
System.out.println(proObj.get("user"));
System.out.println(proObj.get("password"));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
java基础 之 获取包名下资源
猜你喜欢
转载自blog.csdn.net/MENGCHIXIANZI/article/details/105016281
今日推荐
周排行