java - Where do I add a file to read from in Eclipse? -
i have been trying read file eclipse. i've looked on other questions, answers did not remedy situation (refreshing project folder, using getproperty , specifying correct path, etc.) i've moved file every folder , same error. i've copied file directory shown here:

i've pasted code below. it's stupidly simple. error "fileinputstream.open(string) line: not available [native method]".
any appreciated. code below.
import java.io.file; import java.io.filenotfoundexception; import java.util.scanner; import java.util.stringtokenizer; public class modulo { public static void main(string[] args) throws filenotfoundexception { file questions = new file("input.txt"); scanner sc = new scanner(questions); while(sc.hasnext()){ int x = sc.nextint(); string divide = sc.next(); int y = sc.nextint(); system.out.println(x % y); } } }
you copy file project folder parallel src. place base path of code.
Comments
Post a Comment