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 8209835
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T09:51:59+00:00 2026-06-07T09:51:59+00:00

I’m new with running Java from the command line in Windows and can’t get

  • 0

I’m new with running Java from the command line in Windows and can’t get my program to run. To overview, here is exactly what I am trying to do:

Run two .java files, TestCase1.java and UniversalVariables.java
Incorporate multiple external jar files
Do all of this from the command line

TestCase1.java has all of the functioning code, whereas UniversalVariables.java pretty much just has some data, so don’t let all that’s in there confuse you.

It should be noted that I am using Selenium and running it through Eclipse.

Here is TestCase1.java:

package NSSR;

import com.thoughtworks.selenium.*;<br>
import org.junit.After;<br>
import org.junit.Before;<br>
import org.junit.Test;<br>

//Create new NSSR

public class TestCase1 extends SeleneseTestCase {

    public static void main(String[] args) {
        TestCase1 tc1 = new TestCase1();
        try {
            tc1.setUp();
            tc1.testTestCase1();
            tc1.tearDown();
        } catch (Exception e) {

        }
    }

    @Before
    public void setUp() throws Exception {
        selenium = new DefaultSelenium("localhost", 4444, "*firefox",
                UniversalVariables.baseAddress);
        selenium.start();
    }

    @Test
    public void testTestCase1() throws Exception {
        selenium.open(UniversalVariables.loginPage);
        selenium.type("name=USERNAME", UniversalVariables.username);
        selenium.type("name=PASSWORD", UniversalVariables.password);
        selenium.click("link=Submit");
        selenium.waitForPageToLoad("60000");
        selenium.open("/itg/dashboard/app/portal/PageView.jsp?IS_WINDOID=N");
        selenium.click("link=Create");
        selenium.click("link=Request");
        selenium.waitForPageToLoad("30000");
        selenium.select("name=REQUEST_TYPE_CREATE",
                "label=Non-Standard Service");
        selenium.click("css=span.secBtn > a");
        selenium.waitForPageToLoad("30000");
        String title = UniversalVariables.getRandomTitle();
        String req = UniversalVariables.Requestor;
        String dept = UniversalVariables.reqDept;
        String desc = UniversalVariables.getRandomDescription();
        String date = UniversalVariables.getRandomDate();
        System.out.println(title);
        System.out.println(req);
        System.out.println(dept);
        System.out.println(desc);
        System.out.println(date);
        selenium.type("id=REQ.DESCRIPTION", title);
        selenium.type("id=REQ.P.REQUESTORAC_TF", req);
        selenium.select("id=REQ.P.REQUESTOR_DEPT", dept);
        selenium.type("id=REQ.P.DETAIL_DESC", desc);
        selenium.type("REQ.P.REQ_COMPL_DATE", date);
        selenium.click("link=Submit");
        selenium.waitForPageToLoad("30000");
        selenium.refresh();
    }

    @After
    public void tearDown() throws Exception {
        selenium.stop();
    }
}

And here is UniversalVariables.java:

package NSSR;

import java.util.*;

public class UniversalVariables {

    public static String baseAddress = "******";
    public static String loginPage = "******";
    public static String username = "******";
    public static String password = "******";
    public static ArrayList<String> NSSR_Titles = new ArrayList<String>(NSSR_Titles());
    public static String Requestor = "******";
    public static String reqDept = "Shared Services";
    public static ArrayList<String> NSSR_Descriptions = new ArrayList<String>(NSSR_Descriptions());
    public static ArrayList<String> NSSR_Dates = new ArrayList<String>(NSSR_Dates());
    public static Random randy = new Random();
    public static int num;

    public static String getRandomTitle() {
        num = randy.nextInt(NSSR_Titles.size());
        return NSSR_Titles.get(num);
    }

    public static String getRandomDescription() {
        num = randy.nextInt(NSSR_Descriptions.size());
        return NSSR_Descriptions.get(num);
    }

    public static String getRandomDate() {
        num = randy.nextInt(NSSR_Dates.size());
        return NSSR_Dates.get(num);
    }

    public static ArrayList<String> NSSR_Titles() {
        ArrayList<String> list = new ArrayList<String>();
        for(int i = 1; i < 11; i++)
            list.add("Title " + i);
        return list;
    }

    public static ArrayList<String> NSSR_Descriptions() {
        ArrayList<String> list = new ArrayList<String>();
        for(int i = 1; i < 11; i++)
            list.add("Description " + i);
        return list;
    }

    public static ArrayList<String> NSSR_Dates() {
        ArrayList<String> list = new ArrayList<String>();
        for(int i = 1; i < 13; i++)
            for(int j = 1; j < 29; j++)
                for(int k = 13; k < 100; k++) {
                    String str = i + "/" + j + "/20" + k;
                    list.add(str);
                }
        return list;
    }
}

This is what I put into the command line (These are all of the jar files I use. I know it’s not pretty…bear with me.):

>javac -classpath C:\JAR\junit-4.0.jar;C:\JAR\junit-4.0-src.jar;C:\JAR\selenium-java-c
lient-driver.jar;C:\JAR\selenium-java-client-driver-sources.jar;C:\JAR\selenium-
java-client-driver-tests.jar;C:\JAR\selenium-java-client-driver-test-sources.jar
;C:\JAR\selenium-server.jar;C:\JAR\selenium-server-coreless.jar;C:\JAR\selenium-
server-sources.jar;C:\JAR\selenium-server-standalone-2.24.1.jar; NSSR\TestCase1.
java NSSR\UniversalVariables.java

That compiles just fine. I then put this into the command line:

>java NSSR.TestCase1

Then comes the error:

Exception in thread "main" java.lang.NoClassDefFoundError: com/thoughtworks/sele
nium/SeleneseTestCase
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClassCond(Unknown Source)
        at java.lang.ClassLoader.defineClass(Unknown Source)
        at java.security.SecureClassLoader.defineClass(Unknown Source)
        at java.net.URLClassLoader.defineClass(Unknown Source)
        at java.net.URLClassLoader.access$000(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
Caused by: java.lang.ClassNotFoundException: com.thoughtworks.selenium.SeleneseT
estCase
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        ... 12 more
Could not find the main class: NSSR.TestCase1.  Program will exit.

FYI, this is my CLASSPATH:

.;C:\Program Files\Java\jre6\lib\ext\QTJava.zip;C:\WINDOWS\system32\java.exe\lib;C:\Program Files\IBM\RationalSDLC\ClearQuest\cqjni.jar;C:\JAR*.jar

Any help is greatly appreciated!

  • 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-06-07T09:52:01+00:00Added an answer on June 7, 2026 at 9:52 am

    You need to put the jars as a parameter to java as well, same as you passed for javac.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to using the Perl treebuilder module for HTML parsing and can't figure
Does anyone know how can I replace this 2 symbol below from the string
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I am currently running into a problem where an element is coming back from
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I want use html5's new tag to play a wav file (currently only supported
I would like to run a str_replace or preg_replace which looks for certain words

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.