-1
현재 Intellij java에서 Vcard를 사용하는 Project, Qrcode generator에서 작업하고 있습니다.오류 : "정적 컨텍스트에서 비 정적 메서드 toString()을 참조 할 수 없습니다."
오류 : "정적이 아닌 메서드 toString()은 정적 컨텍스트에서 참조 할 수 없습니다."
아무도 나를 도와 줄 수있는이 오류!? 미리 감사드립니다.
내 코드는 :
class HtmlWriter {
private final PrintWriter out;
private final File dir;
private int iota=1;
public HtmlWriter(File dir) throws IOException {
this.dir = dir;
this.out = new PrintWriter(new File(dir,"out.html"));
InputStream x = HtmlWriter.class.getResourceAsStream("/badges.html");
System.out.print(IOUtils.toString(HtmlWriter.class.getResourceAsStream("/badges.html")));
}
public void add(String firstName, String lastName, String company, String email, String tel) throws IOException, WriterException {
VCardBuilder vc = new VCardBuilder();
vc.with("N",firstName+" "+lastName)
.with("ORG", company)
.with("TEL", tel)
.with("EMAIL", email);
System.out.println(vc.toString());
vc.writeQRCode(new File(dir,String.format("qr%04d.png",iota)));
out.printf(
"<div class='badge'>\n" +
" <img class='qrcode' src='qr%04d.png'>\n" +
" <div class='cblogo'></div>\n"+
" <div class='firstName'>%s</div>\n" +
" <div class='lastName'>%s</div>\n" +
" <div class='company'>%s</div>\n" +
"</div>\n", iota, firstName, lastName, company
);
iota++; }
public void close() {
out.println("</body></html>");
out.close();
}
}
org.apache.commons.io 가져 오기를 .IOUtils가 "심볼을 해결할 수 없습니다"오류를 내고 있습니다 –
글쎄, 클래스 패스에 필요한 라이브러리가 있습니까? – 1615903