얘들 아, 내가 여기에이 오류가 여기에 코드 조각 아래에 점점 도움이 필요합니다. 여기에 스택 추적이 있습니다. 누군가 내 부분에 많은 노력을 기울이지 않는다는 느낌이 든다. 그 ok 나는 동의한다, 나에게 제안을 줘야한다 내가 더 많이해야한다. 그리고 병이 나는 단지 조금 붙이게되고, 전진하지 않기 때문에 그것을 여기에서 게시하는 것을 생각했다.java - nullpointer 예외
내가 쓰기에 컨텐트의 크기가 미리 알려진 경우 Excel 파일을 쓰는 데 사용 된 코드를 사용하고있어서 문제가 있다고 생각합니다. 실제로 필요한 것은 행과 열의 길이가 다를 수있을 때 Excel에 쓰는 방법입니다.
Length of Array:2000
java.lang.NullPointerException
at org.temp2.cod2.WriteToExcel.setExcel(WriteToExcel.java:149) >> line 149 is last line of the code snippet below i.e. byte buf[] = s.getBytes();
여기 코드는
data[i-2][j]
이
null
처럼
String data[][] = new String [2000][5];
System.out.println("Length of Array:"+data.length);
for(int j=0;j<colN.length;j++){
Label myLabel1=new Label(j,1,colVal[j]);
wst.addCell(myLabel1);
}
for(int i=2;i<=data.length+1;i++){
for(int j=0;j<colN.length;j++)
{
// Encrypt
encrypter.encrypt(new FileInputStream("C:\\Users\\abc\\Desktop\\Encrypted.txt"),new FileOutputStream("temp.txt"));
// Decrypt
ByteArrayOutputStream f = new ByteArrayOutputStream();
String s = data[i-2][j];
byte buf[] = s.getBytes();
코드는 탭 대신 공백으로 표시됩니다. –