Monday 15 June 2015

netbeans - Error "main.java.lang.IndexOutOfBoundsException: Index: 0, size: 0" and others in Jar file -



netbeans - Error "main.java.lang.IndexOutOfBoundsException: Index: 0, size: 0" and others in Jar file -

let me describe project first.i have source code in java programming language (not programmed me , it's in netbeans ide) .this programme has 4 classes chksubmission.class , parameters.class , plib.class , final relation.class .the programme accepts input dataset folder named "data" contains .zip files , each 1 of .zip files has c++ source codes.then makes complicated compares , extracts results in .txt file name clustering.txt within folder "results" .the programme passes success clean , build progress , got jar file want phone call in html <object></object> tag.i test programme double click , in command line , produced results expected.but after phone call in html didn't produce anything, , if seek run double click doesn't work.if seek run in command line these errors.are parameters ok run applet?please help me .i got confused.the errors are:

exception in thread main.java.lang.indexoutofboundsexception: index:0 size:0 @ java.util.arraylist.rangecheck<unknown source> @ java.util.arraylist.get<unknown source> @ gr.edu.teikav.lmous.research.deltatbl.max <deltatbl.java:37> @ gr.edu.teikav.lmous.research.acf.clust<acf.clust <acf.java:80> @ gr.edu.teikav.lmous.research.chksubmission.submit <chksubmission.java:113> @ gr.edu.teikav.lmous.research.chksubmission.main <chksubmission.java:122>

code:

chksubmission.java

package gr.edu.teikav.lmous.research; import java.applet.applet; import java.io.file; import java.io.filewriter; import java.io.ioexception; import java.io.printwriter; import java.util.arraylist; class relation { string f1, f2; double rel; relation(string fa, string fb, double sim) { f1=fa; f2=fb; rel=sim; } @override public string tostring() { homecoming f1+" "+f2+" "+rel; } } public class chksubmission extends applet{ public static arraylist<string> listfilesforfolder(final file folder) { arraylist<string> rval=new arraylist<>(); (final file fileentry : folder.listfiles()) { if (fileentry.isdirectory()) { listfilesforfolder(fileentry); } else { string fname=fileentry.getname(); if (fname.endswith(".zip")) { rval.add(fname); } } } homecoming rval; } public static arraylist<relation> chk(string inputfolder, string rsltfolder, arraylist<string> keywordlist, double cutoff) throws ioexception, exception { file inputf=new file(parameters.pathofsources+file.separator+inputfolder); arraylist<string> filelist=listfilesforfolder(inputf); arraylist<relation> rval=new arraylist<>(); arraylist<string> invalidsources=new arraylist<>(); (int i=0; i<filelist.size()-1; i++) { string fi=filelist.get(i); if (invalidsources.contains(fi)) continue; (int j=i+1; j<filelist.size(); j++) { string fj=filelist.get(j); if (invalidsources.contains(fj)) continue; //system.out.println(fi+" "+fj); seek { double sim=plib.similarity(inputfolder, fi, fj, keywordlist, invalidsources); if (sim>cutoff) rval.add(new relation(fi,fj,sim)); } grab (exception e) { if (invalidsources.contains(fi)) break; if (invalidsources.contains(fj)) continue; } } } file rfolder=new file(parameters.pathofsources+file.separator+rsltfolder); file rfile=new file(rfolder, "invalidsources.txt"); printwriter out = new printwriter(new filewriter(rfile)); (int i=0; i<invalidsources.size(); i++) out.println(invalidsources.get(i)); out.close(); homecoming rval; } public static void saveclustering(graph g, clustering c, string rsltfolder) throws ioexception, exception { file rfolder=new file(parameters.pathofsources+file.separator+rsltfolder); file rfile=new file(rfolder, "clustering.txt"); printwriter out = new printwriter(new filewriter(rfile)); g.print(out); out.println("-- clustering --"); //out.println(); out.println(c); out.close(); } public static clustering submit(string chkfolder, string rsltfolder, arraylist<string> keywordlist, double cutoff, criterionfunction cf) throws exception { arraylist<relation> rels=chk(chkfolder, rsltfolder,keywordlist,cutoff); arraylist<vertex> verts=new arraylist<>(); arraylist<link> links=new arraylist<>(); (int i=0; i<rels.size(); i++) { relation crel=rels.get(i); vertex v1=new vertex(crel.f1); int v1idx=verts.indexof(v1); if (v1idx<0) verts.add(v1); vertex v2=new vertex(crel.f2); int v2idx=verts.indexof(v2); if (v2idx<0) verts.add(v2); link l=new link(v1,v2,crel.rel); links.add(l); } lib.initiateproject(); graph g=new graph(verts, links, chkfolder); clustering c=new acf().clust(g, cf,0, null); saveclustering(g,c,rsltfolder); homecoming c; } public static void main(string[] args) throws ioexception, exception { parameters.init(); arraylist<string> keywordlist=plib.loadkeywords(); clustering c=submit("data", "results", keywordlist, 0.3, new ilr()); system.out.println(c); } }

so runs applet? applet signed? if no, run in sandbox, , cannot access user files.

heres short peek: http://docs.oracle.com/javase/tutorial/deployment/applet/security.html

java netbeans applet

No comments:

Post a Comment