0

I have a folder on my computer where I store all my code for every language and within this folder I have a folder with my java codes and projects. Currently I have the following layout in terms of folders and files:

Java
    /TD3
        /fr
            /insalyon
                /tc
                    /framework
                        Main.java
                        Main.class
                        JeuCombinatoire.java
                        JeuCombinatoire.class
        /Jeux
            Wythoff.java
            Wythoff.class
            Nim.java
            Nim.class
            EnsembleDeJeux.java
            EnsembleDeJeux.class

All the files in Jeux import JeuCombinatoire from the other directory with import fr.insalyon.tc.framework.JeuCombinatoire; but my issues resides in the execution of Main.java. Everything is compiled correctly other than a use of a deprecated api somewhere which isn't too important. When I run java Main from within the framework folder, I get a java.lang.NoClassDefFoundError so I added a .class to the end and now I get java.lang.ClassNotFoundException.

I'm not quite sure why this is happening nor how to get past this. Thanks in advance.

Max Michel
  • 575
  • 5
  • 20
  • 1
    Try putting the Main class into the Juex package (i.e declaration: package Juex ; to it), set the classpath to parent folder (folder containing Juex), and then compile it. I am guessing you ran it using java from the command line. Other solutions are for Eclipse and IntelliJ, but they have similar concepts. Hope this will help – whoosis Jan 28 '19 at 17:23
  • https://stackoverflow.com/questions/17973970/how-to-solve-java-lang-noclassdeffounderror – whoosis Jan 28 '19 at 17:24
  • I tried your solution and it's close, turns out I need the main out of both packages and then it works. Not 100% why, guess I'll have to read online about it. – Max Michel Jan 28 '19 at 17:40

0 Answers0