Java Project package runs under CMD or Linux
1. Run under CMD
Export the project into a jar package in Eclipse and unzip it with the compression software
After decompression, enter the project root directory in CMD and run the program:
Oracle2redis-jar>java-cp. \lib\*; Oracle.xxx.xx.cn.ReadOracle2Redis
2. Running in Linux
Upload the extracted folder to the Linux system and run it in the project root directory:
Java-cp./lib/*: Oracle.xxx.xx.cn.ReadOracle2Redis (unlike Windows under Path delimiter (\ vs/) and Terminator (; vs:)
PS:
I need to read the database table in time increments, so read the SEQ value in the config file before reading the data, mark the number of rows that have been read, and then record the current read line number seq in the file after reading the increment data.
Using ResourceBundle to read the SEQ value in the configuration file, the class searches for the configuration file at the root of the project and then reads the data inside it.
The configuration file created in eclipse in the SRC directory, eclipse will automatically create the bin folder in the project root directory at compile time, and copy the configuration file to the Bin folder. When the code is running, search for the configuration file under the Bin folder first. This means that the configuration file in the Bin directory will be read first, and if the write configuration file is written to a profile in the SRC directory, it will cause the read/write not the same file.
Then someone would ask why not read and write the configuration files in the bin directory at the same time, because the bin folder will not be created when eclipse exports the jar package, so no.
So when writing the file should go to the SRC directory of the configuration file (in Eclipse debugging will be read and write inconsistencies, reading the bin directory, written in the SRC directory), so that when running the jar package read and write are the same file (jar package of wood has bin directory, is used in the SRC), There is no case that the file cannot be found.
Java Project package runs under CMD or Linux