Re: [javaCompiler-users] Error on reading data
Status: Beta
Brought to you by:
soapy
From: <ext...@no...> - 2006-09-14 13:16:40
|
Hello Marco, I use the 0.8 version of JavaCompiler. I tried to minimize the example that leads to exception. Starting "ReadLines.exe fftshorttmp2.dat 16" worked but "ReadLines.exe fftshorttmp2.dat 17" not any more. But after I copied the files from my network drive to C: the program worked without exceptions!! However it didn't work on C: with another .dat and the number of lines about 2000 (as described in my first email). One aspect which could probably explain the first test is that the network connection from my pc is slowly. But why doesn't it work from C: with greater line number then? I use Java 1.4 and Windows XP SP2. If I start the ReadLines from Eclipse (under Linux) no problems occur. It seems for me that Windows may read the data too slow on my pc, but then I would expect not "NullPointerException" but "OutOfTime" or anything else.. Maybe you can try to start ReadLines.exe once with the attached file and tell me if it works fine on your system? Greetings Igor >-----Original Message----- >From: jav...@li...=20 >[mailto:jav...@li...] On=20 >Behalf Of ext Marco Trudel >Sent: Friday, 25. August 2006 17:09 >To: A mailing list for general questions and discussions. >Subject: Re: [javaCompiler-users] Error on reading data > >Hello Igor > >It works for me with JavaCompiler 0.8 on Windows with a=20 >textfile that has 3780 times the line "12.34 56.78". >I uncomented the System.out.printlns and tried with 1000, 2000=20 >and 3000. > > From your stacktrace, I assume you use an older version of=20 >JavaCompiler. Please update and try again. If you've the=20 >latest version and it (still) fails, please provide=20 >informations about your JavaCompiler settings, the OS and the textfile. >It would be great if you could minimize the example that leads=20 >to the exception... > > >regards >Marco > > >ext...@no... wrote: >> Hello, >>=20 >> I have a strange error using a program compiled with Java=20 >Compiler. My=20 >> code is quite easy and it should only read some data from a=20 >text file=20 >> which has two numbers on every line. The java code is: >>=20 >> ------------------- >> import java.io.FileReader; >> import java.io.BufferedReader; >> import java.util.StringTokenizer; >>=20 >> public class ReadLines { >>=20 >> public static void main(String[] args) { >> double [] realInput =3D new double[new=20 >> Integer(args[1]).intValue()]; >> double [] imaginaryInput =3D new double[new=20 >> Integer(args[1]).intValue()]; >> =20 >> // Read the file >> try { >> FileReader fr =3D new FileReader(args[0]); >> BufferedReader bf =3D new BufferedReader(fr); >> =20 >> // Read the lines >> for(int i=3D0;i<new Integer(args[1]).intValue();i++) = { >> // (1) System.out.println("i: " + i); >> String value =3D new String(); >> value =3D bf.readLine(); >> StringTokenizer st =3D new=20 >StringTokenizer(value); >> st.nextToken(); >> // (2) System.out.println("Reading=20 >the value.."); >> realInput[i] =3D new=20 >> Double(st.nextToken()).doubleValue(); >> // (3) System.out.println("Value set: " +=20 >> realInput[i]); >> imaginaryInput[i] =3D new=20 >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"=20 >> 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=20 >> "java.lang.NullPointerException <<No stacktrace=20 >available>>", but only=20 >> if the number of lines is above about 2000. For smaller line numbers=20 >> it works fine. >>=20 >> BUT: if I uncomment the System.out.println - lines (which=20 >are numbered=20 >> in code as (1)-(4)), I receive no error messages and the=20 >program works=20 >> perfectly for line numbers above 2000!! >>=20 >> Can you please help me and suggest the solution to this problem? >>=20 >> Sincerely yours, >> Igor Vatolkin >>=20 >> PS I'm on vacation from the next Monday so maybe I will read the >> answer(s) not until the mid of September! >>=20 >>=20 >>=20 >---------------------------------------------------------------------- >> -- >>=20 >>=20 >---------------------------------------------------------------------- >> --- Using Tomcat but need to do more? Need to support web services,=20 >> security? >> Get stuff done quickly with pre-integrated technology to=20 >make your job=20 >> easier Download IBM WebSphere Application Server v.1.0.1 based on=20 >> Apache Geronimo >>=20 >http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D120709&bid=3D263057&dat=3D= 1216 >> 42 >>=20 >>=20 >>=20 >---------------------------------------------------------------------- >> -- >>=20 >> _______________________________________________ >> javaCompiler-users mailing list >> jav...@li... >> https://lists.sourceforge.net/lists/listinfo/javacompiler-users > >--------------------------------------------------------------- >---------- >Using Tomcat but need to do more? Need to support web=20 >services, security? >Get stuff done quickly with pre-integrated technology to make=20 >your job easier Download IBM WebSphere Application Server=20 >v.1.0.1 based on Apache Geronimo >http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D120709&bid=3D263057&d >at=3D121642 >_______________________________________________ >javaCompiler-users mailing list >jav...@li... >https://lists.sourceforge.net/lists/listinfo/javacompiler-users > |