JUNIT Eclipse - java.lang.Classnotfoundexception

Asked

Viewed 482 times

0

All my tests using JUNIT no longer work. I tried unfortunately to remove all the /bin and some other configuration files. project .classpath. OK so far was already a lot of nonsense, then I tried to create another project and pass only the classes but I realized that JUNIT does not work in any project.

Does anyone have any idea ? GITHUB

Class:

package br.test;

import org.junit.Test;

public class TestMotosPersist {


    @Test
    public void criaMotos(){
        int a = 1;
    }
}

Mistakes:

TestMotosPersist [JUnit]    
    org.eclipse.jdt.internal.junit.runner.RemoteTestRunner at localhost:60874   
        Thread [main] (Suspended (exception ClassNotFoundException))    
            owns: Object  (id=22)   
            owns: Object  (id=23)   
            URLClassLoader$1.run() line: 366    
            URLClassLoader$1.run() line: 355    
            AccessController.doPrivileged(PrivilegedExceptionAction<T>, AccessControlContext) line: not available [native method]   
            Launcher$ExtClassLoader(URLClassLoader).findClass(String) line: 354 
            Launcher$ExtClassLoader(ClassLoader).loadClass(String, boolean) line: 425   
            Launcher$AppClassLoader(ClassLoader).loadClass(String, boolean) line: 412   
            Launcher$AppClassLoader.loadClass(String, boolean) line: 308    
            Launcher$AppClassLoader(ClassLoader).loadClass(String) line: 358    
            LauncherHelper.checkAndLoadMain(boolean, int, String) line: 482 
    /usr/lib/jvm/java-7-openjdk-amd64/bin/java (07/05/2015 21:58:01)    

This happens in every test in any project, I have tried to reassemble project, restart eclipse.. etc

Who wants to see the full source GITHUB

Arquivos Erros

  • Try to place the junit jar inside the libs folder.

  • Thanks for your attention friend, I could not get a direct solution to the problem, I needed to delete . Metadata in Workspace

1 answer

0


I managed to solve, it was not the best solution but I got.

The mess I made with eclipse was in the file . This is hidden in the Workspace folder (if you use the default folder).

To view the file Press Ctrl+H in Ubuntu and windows have the option to show hidden in folder configuration Diretórios do sistema

Removing the folder, Eclipse reconfigured everything and started working again. This problem was not so much about Java, but eclipse configuration. So I’m sorry, I know this is beyond the scope of the O.R., but I didn’t know.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.