JUNIT Test class in Eclipse - java.lang.ClassNotFoundException

后端 未结 26 1927
栀梦
栀梦 2020-12-14 13:55

I\'m trying to run my junit test (to verify that a properties file loads correctly) but I get ClassNotFoundException although the class is there and all requir

相关标签:
26条回答
  • 2020-12-14 14:45

    Are you sure your test class is in the build folder? You're invoking junit in a separate JVM (fork=true) so it's possible that working folder would change during that invocation and with build being relative, that may cause a problem.

    Run ant from command line (not from Eclipse) with -verbose or -debug switch to see the detailed classpath / working dir junit is being invoked with and post the results back here if you're still can't resolve this issue.

    0 讨论(0)
  • 2020-12-14 14:45

    Please make sure the output folder in Java Build Path tab set as like below,which would determine where the .class file are generated.Then clean the project.

    0 讨论(0)
提交回复
热议问题