Reputation: 107
I've been trying to execute the code someone else gave me. I'm 100% sure it should compile. I'm following the common method to compile and execute this java code, but it's just not working for me. I've already execute Java code in the past, but I can't seem to find a way around unfortunatly.
What I usually do:
Here is a simplify version of the "Jeu class" code:
package core;
import java.io.ByteArrayInputStream;
import java.io.ObjectInputStream;
import java.io.PipedInputStream;
import java.io.PipedOutputStream;
import java.util.Arrays;
import java.util.List;
public class Jeu {
public static void main(String [ ] args) {
// stuff
}
}
After reading some tips online, I tried "java core.Jeu" or even "java core/Jeu" without success. Still the same message "Could not find or load main class”.
The problem is not the java compiler(set path command). It's totally working because when I tried to compile my classes one at a time, the cmd showed me a compilation error about dependencies. Using "javac *.java" fixed it
Since the class "Jeu" is dependant from other class like "Voiture", could the problem be that the "Jeu.java" didn't compile correctly even though the "Jeu.class" exist?
Upvotes: 1
Views: 539
Reputation: 89
Make sure you current directory in the classpath java -cp . core.Jeu
. will include the current directory in the class path. Or you can include the absolute path as well
Upvotes: 0
Reputation: 4399
Is your core.Jeu
class in core
directory? Are you calling java
from outside of core
directory?
Upvotes: 1