[RESOLVED] NoClassDefFoundErr
Code:
package codeBreaker;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.BufferedInputStream;
import java.io.PrintWriter;
public class depth {
public static int deCode;
public static void main(String[] args) {
String UI;
inCodeHandler ih = new inCodeHandler();
System.out.println("Text you want encoded:");
try(InputStreamReader isr = new InputStreamReader(System.in); BufferedReader
br = new BufferedReader(isr)) {
UI = br.readLine();
ih.storE(UI);
} catch(FileNotFoundException fn) {
System.err.format("FNF Err@: %s%n FNF ErrMessage: %s%n",
fn.getStackTrace(), fn.getMessage());
}catch(IOException ioe) {
System.err.format("ioe Err@: %s%n ioe ErrMessage: %s%n",
ioe.getStackTrace(), ioe.getMessage());
}
}
}
Code:
package codeBreaker;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.BufferedInputStream;
import java.io.PrintWriter;
public class inCodeHandler {
public static void storE(String input) {
BufferedWriter bw;
try {
bw = new BufferedWriter(new FileWriter("Coded.txt", true));
bw.write(input);
bw.newLine();
bw.flush();
} catch (IOException ioe) { ioe.printStackTrace(); }}
public static void readInput() {
String input;
try {
InputStreamReader isr = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(isr);
input = br.readLine();
Case1:
if(input.equals("a")) {
storE("7sd5f4s2");
} else if (input.equals("The")) {
storE("7hj5f6s"); }
} catch (IOException e){
System.out.println("Error reading from user");
}
}
}
I changed the dept class I invoked store like this instead
Code:
inCodeHandler.storE(UI);
Anyways, here's the error I get either way I invoke storE.
Code:
Error: Could not find or load main class java
Press any key to continue . . .
It's just odd to me that it would give me this message I am not invoking the inCodeHanlder class. Just a method.. I could just simply add a main class, but I want to know why it's giving me this error. So that's what I'm asking form this overly drawn out post. I just want to know why it's giving me this error when I'm not calling the class, just a method.
P.S: I just realized that I used storE when I should have been using readInput. So I changed it did same thing with readInput as I did with storE and, the same problem persisted.