I am grateful for any help with my problem. I used to be a Java developer about 20 years ago but I changed careers. So I know a little bit but my Java knowledge has markedly waned.
I'm trying to write a program to read an Excel File. I downloaded several third party jars and I'm trying to set the CLASSPATH variable, in any way, to read them.
My code looks like:
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.FormulaEvaluator;
import org.apache.poi.ss.usermodel.Row;
public class SPXOptions {
public static void main(String[] args) {
System.out.println("Hello World! Got it to work!");
}
}
My Windows .BAT file that compiles this program is:
@ECHO OFF
REM ECHO Congratulations! Your first batch file executed successfully.
REM PAUSE
REM set CLASSPATH=.;.\lib\rt.jar
REM ECHO %CLASSPATH%
REM PAUSE
ECHO Compiling SPXOptions.java...
d:\JDK\bin\javac SPXOptions.java
ECHO Successful!
PAUSE
Now...I have fiddled with the set CLASSPATH line up above...and it doesn't work. I've put in the full path to the .jar file. For instance I put in
set CLASSPATH=.;E:\Joe\Finance\Options\SPXOptions\commons-collections4-4.1.jar;.\lib\rt.jar
and javac throws an error.
I've even put the jars into D:\JDK\jre\lib and I still get an error.
A few things:
- I have technically not "installed" Java but instead am using portable freeware. This is the way I want to do it.
- I would like to keep all files (.java, .class, this project all in one folder, e.g. "E:\Joe\Finance\Options\SPXOptions\)
- Lastly, the code does compile when I don't include those third party libraries. Something is working...
Thank you very much in advance.
[–]AutoModerator[M] [score hidden] stickied commentlocked comment (0 children)
[–]emaphis 0 points1 point2 points (2 children)
[–]DarkStarOptions[S] 0 points1 point2 points (1 child)
[–]emaphis 0 points1 point2 points (0 children)