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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T07:39:54+00:00 2026-05-30T07:39:54+00:00

I am trying to run a jar using this command in my shell script

  • 0

I am trying to run a jar using this command in my shell script –

java -Dlog4j.configuration=path/to/log4j.properties -classpath path/to/log4j.jar:path/to/another.jar -cp my/jarfile/to/run/myjar.jar com.xyz.TestSuiteRunner CREATE_4_SL

But when I run this, I get the error as shown –

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/log4j/Logger

at com.xyz.TestSuiteRunner.<clinit>(TestSuiteRunner.java:27) 
Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Logger
    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)
    ... 1 more
Could not find the main class: com.xyz.TestSuiteRunner.  Program will exit.

After referring to other similar posts, I do know that I can create a runnable jar file using a manifest file but I don’t want to do it that way. Can anyone please let me know where am I going wrong over here?

  • 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-30T07:39:55+00:00Added an answer on May 30, 2026 at 7:39 am

    You’ve got both -classpath and -cp switches; -cp is just an abbreviation for -classpath, and you can’t have more than one of these. The last one is the one that “sticks”, so any classes named in the first -classpath switch won’t be found. You need to combine those arguments into one long path; i.e.,

    -classpath path/to/log4j.jar:path/to/another.jar:my/jarfile/to/run/myjar.jar
    

    The error about not being able to find the main class is a bit of a red herring; the class is clearly found, it just can’t be initialized because its dependencies aren’t found.

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

Sidebar

Related Questions

I am trying to run this dreadfully simple command in Bash java -cp nasa-top-secret.jar
I am trying to run a java based tool using a command line syntax
I am trying to run Selenium Server using a network path as follows: java
I am trying to run a jar with the log4j.xml file on the file
I'm trying to dynamically run a .jar from a C# assembly (using Process.Start(info) ).
I'm trying to compile a java program that is using JavaDB/Derby. On the command
I'm trying to run a sample Java application from the command promopt but I'm
I am trying to run a .jar file that I have created using either
I am trying to run a class from a JAR. This class is NOT
Am trying to run a selenium suite using this code which runs perfectly on

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.