Java Code Compiles in Command Line but not NetBeans -
i literally compiling same java file in both command line , netbeans different results. maddening , confusing. code simple , correct in command line. "error" in netbeans. should not vary far can tell...
import java.io.*; public class a3 { public static void main(string[] args) { bufferedreader filereader = null; try { filereader = new bufferedreader(new filereader("input.txt")); string aline = filereader.readline(); string mytokens[] = aline.split(" "); system.out.println("token 1 = " + mytokens[0]); system.out.println("token 2 = " + mytokens[1]); filereader.close(); } catch(ioexception anexception) { system.out.println("error"); } } }
solved! way overthinking things. command line looks .txt file in same directory .java. logical. netbeans looks in root directory. is...yeah.
error occurs @ line (you can use debugger):
filereader = new bufferedreader(new filereader("input.txt"));
you can have look: where java files?
Comments
Post a Comment