내 프로그램은 큰 텍스트 파일 (45MB)을 사용하여 작동하며 잘 실행됩니다. 항아리로 내 보낸 후에는 큰 소스 파일에 액세스 할 때 제대로 작동하지 않습니다. 작은 파일 (300kB)에는 아무런 문제가 없습니다.내 JAR은 일식으로 실행될 때와 같이 작동하지 않습니다.
Eclipse : 10 초 동안 정지 한 다음로드 된 파일이 준비되었습니다.
용기 : 5 초 동안 정지되고 아무 일도 일어나지 않습니다.
제대로 작동하려면 JAR을 어떻게 변경할 수 있습니까?
편집 :
public String [] RetreiveTokens(){
String path = Main_Win.class.getProtectionDomain().getCodeSource().getLocation().getPath();
String decodedPath = null;
try {
decodedPath = URLDecoder.decode(path, "UTF-8");
} catch (UnsupportedEncodingException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
String FileName=decodedPath+"languages/D3.txt";//LangPath+SourceFileLists.get(i);
String content = null;
boolean DictCC = false;
int ContentsAddress=0;
try {
BufferedReader fin;
String lineFromFile="";
try {
fin = new BufferedReader(new FileReader(FileName));
//System.out.println("cc");
lineFromFile = fin.readLine();
lineFromFile=lineFromFile.substring(3);
if(lineFromFile.substring(0,1).equals("#")){
DictCC=true;
for(ContentsAddress=0; fin.readLine().length()>0; ContentsAddress++);
ContentsAddress+=2;
//System.out.println(ContentsAddress);
}
fin.close();
} catch (IOException e) {
e.printStackTrace();
}
//System.out.println(lineFromFile);
//if(!DictCC){
content = new Scanner (new File (FileName), "UTF-8").useDelimiter("\\Z").next();
//}
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
String[] tokens=null;
//String[][] Words_1=new String[2][32];;
if(!DictCC){
content=content.substring(1);
content=content.replace("\r\n\r\n", "\r\n");
tokens = content.split("\r\n");
}
else {
content = content.split("\r\n")[ContentsAddress];
tokens = content.split(" ");
}
for (int t=0; t<tokens.length; t++){
if(tokens[t].contains("\n")){
int index = nthOccurrence(tokens[t], '\n', 0);
tokens[t]=tokens[t].substring(index);
}
if(tokens[t].contains("[")){
tokens[t]=tokens[t].replace(" [", "[");
tokens[t]=tokens[t].replace("] ", "]");
tokens[t]=tokens[t].replaceAll("\\[.*\\]", "");
}
if(tokens[t].contains("<")&&tokens[t].contains(">")){
tokens[t]=tokens[t].replace(" <", "<");
tokens[t]=tokens[t].replace("> ", ">");
tokens[t]=tokens[t].replaceAll("\\<.*\\>", "");
}
tokens[t]=tokens[t].replaceAll("[?¿!¡,.;/'{}]", "");
tokens[t]=tokens[t].replace("\n", "").replace("\r", "");
}
return tokens;
}
응용 프로그램이 고정되었다는 것은 무엇을 의미합니까? 콘솔에서 예외가 발생 했습니까? – AlexR
어떻게 이클립스 외부에서 응용 프로그램을 실행합니까? 명령 줄을 보낼 수 있습니까? – AlexR
JAR에 * 묶음 *되어야하는 파일을로드하려고 시도하는 것 같습니다. 이 올바른지? – Kai