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

  • Home
  • SEARCH
  • 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 9004703
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:57:19+00:00 2026-06-16T00:57:19+00:00

The issue is that when I run it via Eclipse Juno by clicking on

  • 0

The issue is that when I run it via Eclipse Juno by clicking on it and “Run as Java Application” it works,
but it needs to be to run in a Linux shell script or at least from the Linux shell.

I need it to append all the jar files from $CATALINA_HOME/webapps/myapp/WEB-INF/lib to my classpath.

Here’s my code:

package com.myapp.client;

public class ClientApp {
    public static void main(String args[]) {
        System.out.println("Hi Client");
    }
}

When I cd into $CATALINA_HOME/webapps/myapp/WEB-INF/classes/com/myapp/client issue the following command:

java -classpath "/home/devuser/DevTools/apache-tomcat-7.0.32/webapps/myapp/WEB-INF/lib/*:." ClientApp

I receive this exception:

Exception in thread "main" java.lang.NoClassDefFoundError: ClientApp (wrong name: com/myapp/client/ClientApp)
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
    at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Could not find the main class: ClientApp.  Program will exit

When I go to my home dir (/home/devuser) and type this in, it still doesn’t work:

java -classpath "/home/devuser/DevTools/apache-tomcat-7.0.32/webapps/myapp/WEB-INF/lib/*:." $CATALINA_HOME/webapps/myapp/WEB-INF/classes/com.myapp.ClientApp

Exception in thread "main" java.lang.NoClassDefFoundError: /home/devuser/DevTools/apache-tomcat-7/0/32/webapps/myapp/WEB-INF/classes/com/myapp/ClientApp
Caused by: java.lang.ClassNotFoundException: .home.devuser.DevTools.apache-tomcat-7.0.32.webapps.myapp.WEB-INF.classes.com.myapp.ClientApp
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Could not find the main class: /home/devuser/DevTools/apache-tomcat-7.0.32/webapps/myapp/WEB-INF/classes/com.myapp.ClientApp.  Program will exit.

Thank you for taking the time to read this… Would appreciate it if someone could assist me.

  • 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-16T00:57:21+00:00Added an answer on June 16, 2026 at 12:57 am

    All of your libraries and classes need to be in your classpath, then the next argument is the path to your class.

    java -cp '.:/path/to/libdir/*:/path/to/myapp.war' com.myapp.client.ClientApp
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developing a small Java application using Swing, that is supposed to run
I've recently run into an issue that no amount of online searching seems to
From time to time I run into the issue that Grails integration tests the
I've run into an issue installing a product that has worked at several customer
I have an issue that (I think) might have to do with scope, but
I've run into an interesting issue that I'm afraid might be a bug with
I have some unit tests set up in my PowerBuilder application that run through
I have several test modules that are all invoked together via a driver script
I have a MVC page that loads a Partial via a Ajax.ActionLink, which works,
I run a site that is slowly but surely draining all of the available

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.