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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T06:37:43+00:00 2026-05-30T06:37:43+00:00

I am trying execute a java class which accesses a method in a jar

  • 0

I am trying execute a java class which accesses a method in a jar file.My package structure is com.xmlpost.XmlPostInit.java and it resides under the directory:

  D:\Workspace\Test\bin

I am using the command below. Note, cs.jar contains the class com.xmlpost.XmlPostInit

D:\Workspace\Test\bin>java -classpath D:\FatWire\JSK\7.6.0\App_Server\apache-tomcat-6.0.18\webapps\cs\WEB-INF\lib\cs.jar com.xmlpost.XmlPostInit

.. which gives me following error:

Exception in thread "main" java.lang.NoClassDefFoundError: com/xmlpost/XmlPostInit
Caused by: java.lang.ClassNotFoundException: com.xmlpost.XmlPostInit
        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)
Could not find the main class: com.xmlpost.XmlPostInit.  Program will exit.
  • 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-30T06:37:44+00:00Added an answer on May 30, 2026 at 6:37 am

    You have to add your bin directory to the classpath too, as the JVM needs to look inside it to find your class. As you are running inside it, you can refer localy it with “.”:

    D:\Workspace\Test\bin>java -classpath .;D:\FatWire\JSK\7.6.0\App_Server\apache-tomcat-6.0.18\webapps\cs\WEB-INF\lib\cs.jar com.xmlpost.XmlPostInit
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to work on a project which involves running/executing the java file
I'm trying to execute the script with PreparedStatemnent: import java.sql.*; public class DeclaredStatement {
I'm trying to execute a simple batch file from java using Runtime.getRuntime().exec(command); but facing
I have a jar file which mentions the main class in the manifest. When
I'm trying to execute the getPendingSalesOrderIDs() method which calls upon method selectInAsending(...). But this
I'm trying to execute a copy of the Perl interpreter using Java's Runtime.exec(). However,
I'm trying to execute a simple example of Multicast sockets on Java. MulticastSocket s
For my java program I'm using Rhino to execute JS scripts. Now I'm trying
Is it possbile to execute linux commands with java? I am trying to create
I am trying to execute this SQL query prior to restoring a .BAK file

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.