Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Eclipse Junit: java.lang.ClassNotFoundException
Eclipse Junit: java.lang.ClassNotFoundException [message #1792746] Mon, 23 July 2018 13:11 Go to next message
Bruno Pistone is currently offline Bruno PistoneFriend
Messages: 1
Registered: July 2018
Junior Member
I have the following problem:

I have a java project that uses gradle. The project structure is:

- main
-- java
-- resources
- test
-- java
-- resources

I have the following test class:

package it.main.tests;

import static org.junit.Assert.assertEquals;

import org.junit.Test;

public class MainTest {

    public void mainTests() {
        String s = "ciao";

        assertEquals(s, "ciao");

If I run the following command: gradle test everything is ok. If I try to run the mainTests method from eclipse (right click on the method, Run As, JUnit test) I have the following exception:

Class not found it.main.tests.MainTest
java.lang.ClassNotFoundException: it.main.tests.MainTest
    at java.lang.ClassLoader.loadClass(
    at sun.misc.Launcher$AppClassLoader.loadClass(
    at java.lang.ClassLoader.loadClass(
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.loadClass(
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.loadClasses(
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(
Re: Eclipse Junit: java.lang.ClassNotFoundException [message #1792784 is a reply to message #1792746] Tue, 24 July 2018 03:57 Go to previous message
Sarika Sinha is currently offline Sarika SinhaFriend
Messages: 80
Registered: February 2010
Location: Bangalore, India
Which version of Eclipse and Junit is being used ? Can you create a bug with all the details ?

Sarika Sinha
JDT Programmer
Previous Topic:not showing maven dependency in eclipse
Next Topic:Resolution of test classes failing when the dependency they originate is Java 9/10 module ?
Goto Forum:

Current Time: Mon Nov 19 01:41:56 GMT 2018

Powered by FUDForum. Page generated in 0.01399 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top