I have a .class that I've compiled from a .java
package csvExam.MyCSVParser;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
public class MyCSVParser {
public static void main(String[] args){
String csvFile = "/Users/dbaug/Desktop/idestuff/csvExam/testme.csv";
BufferedReader br = null;
String line = "";
String cvsSplitBy = ",";
if(csvFile==null){
System.out.println("no CSV File found, try again.");
}else{
try {
br = new BufferedReader(new FileReader(csvFile));
while ((line = br.readLine()) != null) {
String[] mainLine = line.split(cvsSplitBy);
System.out.println("am I reading anything");
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (br != null) {
try {
br.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
}
}
I am able to compile using javac MyCSVParser.java and I received a MyCSVParser.class both of these files sit in "C:\Users\dbaug\Desktop\idestuff\csvExam"
my %PATH% is:
C:\Program Files (x86)\Razer Chroma SDK\bin;C:\Program Files\Razer Chroma SDK\bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\WINDOWS\System32\OpenSSH\;C:\WINDOWS\system32\config\systemprofile\AppData\Local\Microsoft\WindowsApps;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Java\jdk1.8.0_191\bin;C:\Program Files\dotnet\;C:\Users\dbaug\AppData\Local\Microsoft\WindowsApps;C:\Users\dbaug\AppData\Local\GitHubDesktop\bin;C:\Program Files\Java\jdk1.8.0_191\bin;
where you can see ";C:\Program Files\Java\jdk1.8.0_191\bin;" at the bottom.
in Environmental Variables I have variable path set to "C:\Program Files\Java\jdk1.8.0_191\bin"
Below are all the inputs and results I encounter.
Microsoft Windows [Version 10.0.17763.316] (c) 2018 Microsoft Corporation. All rights reserved.
C:\Users\dbaug>cd c:\
c:>java -classpath C:\Users\dbaug\Desktop\idestuff\csvExam MyCSVParser Error: Could not find or load main class MyCSVParser
c:>java -cp C:\Users\dbaug\Desktop\idestuff\csvExam MyCSVParser Error: Could not find or load main class MyCSVParser
c:>cd C:\Users\dbaug\Desktop\idestuff\csvExam
C:\Users\dbaug\Desktop\idestuff\csvExam>java MyCSVParser Error: Could not find or load main class MyCSVParser
C:\Users\dbaug\Desktop\idestuff\csvExam>cd C:\Users\dbaug\Desktop\idestuff
C:\Users\dbaug\Desktop\idestuff>java csvExam.MyCSVParser Error: Could not find or load main class csvExam.MyCSVParser
C:\Users\dbaug\Desktop\idestuff>
I'm not trying to do anything special besides just trying to get a .class to run through terminal, as that's my next step from an IDE to validate my programs working. However I've been stumped all day over what I might be doing wrong and I'm just not sure. I run Windows 10, trying to use Java JDK jdk1.8.0_191, I downloaded from oracle java website.