Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 676621
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T00:56:55+00:00 2026-05-14T00:56:55+00:00

Ok, I am like other and new to jUnit and having a difficult time

  • 0

Ok, I am like other and new to jUnit and having a difficult time trying to get it working. I have searched the forum but the answers provided; I am just not getting. If anyone out there could lend me a hand I would greatly appreciate it.

Let me provide the basics:
OS: mac OS X.6

export JUNIT_HOME="/Developer/junit/junit4.8.1"
export CVSROOT="/opt/cvsroot"
export PATH="/usr/local/bin:/usr/local/sbin:/usr/localmysql/bin:/opt/PalmSDK/Current/bin/:/usr/local/mysql/bin:$PATH:$JUNIT_HOME:$CVSROOT"
export CLASSPATH="$CLASSPATH:$JUNIT_HOME/junit-4.8.1.jar:$JUNIT_HOME"

I can compile a test class from a java file, however when I try to then run the test

java org.junit.runner.JUnitCore MyTest.class 

I get the following:

JUnit version 4.8.1
Could not find class: MyTest.class

Time: 0.001

OK (0 tests)

Now I have been in the directory with the MyTest.class which is just somewhere in my file system, I tried moving the source folder to the junit folder and the junit/junit4.8.1 folder and the same result. I cannot even run the tests that came with junit.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T00:56:55+00:00Added an answer on May 14, 2026 at 12:56 am

    Is MyTest really in the default package? If not, then you need to give the entire package-qualified name. In other words, if MyClass has a statement

    package com.myself;
    

    and lives in

    /myproject/src/com/myself/MyClass.java
    

    and you compiled into

    /myproject/classes
    

    then /myproject/classes must be on your CLASSPATH and you must

    java org.junit.runner.JUnitCore com.myself.MyTest
    

    Come to think of it, I see now that you’re appending .class to the class name, so even if it’s in the default package, you should just say

    java org.junit.runner.JUnitCore MyTest
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am very new to symfony. In other languages like java and others I
There a bunch of other questions like this, but the only substantial answer I've
I have around 10 JUnit that will be executed automatically. I would like to
I am new to CI. I am using version 2. I noticed like other
I'm trying to write JUnit tests for my code but with in some of
I'm new to build automation and Continuous Integration, but have done extensive research on
Suppose you have a method like public Something copy () { return new Something();
Like several other people, I'm having problems serializing Entity Framework objects, so that I
I am trying to create 10.000 hexagon connected each other like bee combs.I want
I'm building an ASP.net custom control that implements IScriptControl . I would like other

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.