I'm trying to get an program that I coded to run properly. So far it will javac and java fine, however I get a NoClassDefFoundError.
This screenshot shows how I've javac, java the program, and the command prompt report.
As you can see I have 3 source files, and therefore 3 classes. PeriodicTable doesn't do anything related to the issue.
Inside of class Table I have...
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.json.JsonArray;
import javax.json.JsonObject;
import java.awt.GridBagLayout;
import java.awt.GridBagConstraints;
import java.awt.Color;
import java.awt.Toolkit;
import java.awt.Dimension;
import java.io.IOException;
class Table {
//Predefining some global variables
DataBaseReader dbReader;
//some methods...
protected void showLayout() {
dbReader = new DataBaseReader();
//A few lines of code
try {
JsonArray elements = dbReader.readDataBase(); //Here it enters the DataBaseReader class through dbReader
//Some more code
} catch(IOException ioe) {
ioe.printStackTrace();
}
}
}
Here is my DataBaseReader class
import javax.json.Json;
import javax.json.JsonReader;
import javax.json.JsonObject;
import javax.json.JsonArray;
import java.io.FileReader;
import java.io.IOException;
public class DataBaseReader
{
public JsonArray readDataBase() throws IOException {
System.out.println("Check!"); //This check is reached
JsonReader reader = Json.createReader(new FileReader("C:/projects/PeriodicTable/Elements.JSON"));
System.out.println("Check!"); //This check is not reached
JsonObject jsonst = reader.readObject();
reader.close();
return jsonst.getJsonArray("Elements");
}
}
What versions, programs, etc am I using?
Java 8
Command Prompt
Notepad
javax.json-1.0.jar
To clearly state my question... Any ideas or explanations about what is causing this error?