how to run a java program from command line with a text file as an input argument -


this question has answer here:

i have assignment university , want make program reads maze text file. question how can adjust program make run command line this:

java thiseas path_to_file/filename.txt

if helps using java.util.scanner file reader. haven't found online this, , honest don't know how correctly. if has ideas on how make work please reply.

thanks in advance

edit: question couldn't clearer. found answer myself, has same question have

file f = new file(args[1]);

then able run program command window file input argument (args[1]).

  • first make sure jdk installed , path set

    • then u can generate byte code javac program_name.java
    • run java program_name

Comments

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -