I have a need to pass multiple command line parameters to the executable jar. I am trying to automate one of the manual task. I am trying to read from one file and writing it's content to other files based on command line argument.
Here is the command :
> java -jar CreateFiles.jar C:\source\MasterFile.xlsx C:\destination\Dump_here\ 2 100
arg[0]: master file
arg[1]: Destination Directory and this is not a file. Here files will be generated with some suffix like File_1,File_2 etc.
arg[2]: number of files
arg[3]: records in each file
Things I tried: -While first argument arg[0] seems fine, its failing at arg[1]. -once I removed arg[1], just to check whether it gets through, it fails at arg[2] which is an integer value.
How can I achieve the purpose here ?
Main method:
String RawFile = args[0];
String DestinationPath=args[1];
int numFiles = Integer.parseInt(args[2]);
int numRecords = Integer.parseInt(args[3]);
I am getting below error :
> Analysing C:\source\MasterFile.xlsx Exception in thread "main"
> org.apache.commons.compress.archivers.ArchiveException: Archiver:
> C:\destination\Dump_here\ not found. at
> org.apache.commons.compress.archivers.ArchiveStreamFactory.createArchiveInputStream(ArchiveStreamFactory.java:391)
> at
> org.apache.commons.compress.archivers.ArchiveStreamFactory.createArchiveInputStream(ArchiveStreamFactory.java:328)
> at
> org.apache.commons.compress.archivers.Lister.createArchiveInputStream(Lister.java:71)
> at
> org.apache.commons.compress.archivers.Lister.listStream(Lister.java:59)
> at org.apache.commons.compress.archivers.Lister.main(Lister.java:53)