Re: [javaCompiler-users] Error on reading data
Status: Beta
Brought to you by:
soapy
From: Marco T. <mt...@gm...> - 2006-08-25 15:09:15
|
Hello Igor It works for me with JavaCompiler 0.8 on Windows with a textfile that has 3780 times the line "12.34 56.78". I uncomented the System.out.printlns and tried with 1000, 2000 and 3000. From your stacktrace, I assume you use an older version of JavaCompiler. Please update and try again. If you've the latest version and it (still) fails, please provide informations about your JavaCompiler settings, the OS and the textfile. It would be great if you could minimize the example that leads to the exception... regards Marco ext...@no... wrote: > Hello, > > I have a strange error using a program compiled with Java Compiler. My > code is quite easy and it should only read some data from a text file > which has two numbers on every line. The java code is: > > ------------------- > import java.io.FileReader; > import java.io.BufferedReader; > import java.util.StringTokenizer; > > public class ReadLines { > > public static void main(String[] args) { > double [] realInput = new double[new > Integer(args[1]).intValue()]; > double [] imaginaryInput = new double[new > Integer(args[1]).intValue()]; > > // Read the file > try { > FileReader fr = new FileReader(args[0]); > BufferedReader bf = new BufferedReader(fr); > > // Read the lines > for(int i=0;i<new Integer(args[1]).intValue();i++) { > // (1) System.out.println("i: " + i); > String value = new String(); > value = bf.readLine(); > StringTokenizer st = new StringTokenizer(value); > st.nextToken(); > // (2) System.out.println("Reading the value.."); > realInput[i] = new > Double(st.nextToken()).doubleValue(); > // (3) System.out.println("Value set: " + > realInput[i]); > imaginaryInput[i] = new Double(0).doubleValue(); > // (4) System.out.println("Zero set.."); > } > bf.close(); > fr.close(); > } catch(Exception e) { > e.printStackTrace(); > } > } > } > ------------------- > The program can be started with e.g. "ReadLines.exe data.txt 2000" which > means "read 2000 lines from data.txt" > If I start program from Eclipse, or jar, it works. > If I start exe made by JavaCompiler, I receive error message > "java.lang.NullPointerException <<No stacktrace available>>", but only > if the number of lines is above about 2000. For smaller line numbers it > works fine. > > BUT: if I uncomment the System.out.println - lines (which are numbered > in code as (1)-(4)), I receive no error messages and the program works > perfectly for line numbers above 2000!! > > Can you please help me and suggest the solution to this problem? > > Sincerely yours, > Igor Vatolkin > > PS I'm on vacation from the next Monday so maybe I will read the > answer(s) not until the mid of September! > > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > > > ------------------------------------------------------------------------ > > _______________________________________________ > javaCompiler-users mailing list > jav...@li... > https://lists.sourceforge.net/lists/listinfo/javacompiler-users |