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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T19:35:42+00:00 2026-05-30T19:35:42+00:00

I have a program that resides in a directory that is not set in

  • 0

I have a program that resides in a directory that is not set in the path/classpath – and I want to execute it using the -cp option on my console. But I get the NoClassDefFoundException, regardless of what I set as -cp

- out
 `- de
  `- my
   `- package
    `- MainClass.class

I navigate into the package directory and try to execute the main class using

MyBook-Pro:out flopes$ java -cp . de.my.package.MainClass

What am I doing wrong 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-30T19:35:44+00:00Added an answer on May 30, 2026 at 7:35 pm

    The classpath must contain

    • jar files
    • directories containing the roots of the package tree.

    If your package is de.my.package, the root is de, and the directory containing de must be in the classpath.

    So, if you’re in the package directory, the classpath should be set to ../../..: the out directory is the one that should be in the classpath.

    Or you should use . as the classpath, but launch your program from the out directory.

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

Sidebar

Related Questions

I am trying to execute/call a python script that resides in another directory. My
Say I have app TestApp.exe While TestApp.exe is running I want a separate program
I am just learning Blend/Silverlight/VS2010/.net/etc. I have a simple project that resides on a
If I have a string formatting program in C, that consists of only one
For a program that I have written myself, is there a method of accessing
I have an application using sockets.. a client and server program like mySql.. I
I usually don't have any problems setting up the classpath and running programs, but
I am developing a project in C++. I realised that my program is not
I have a Haskell script that runs via a shebang line making use of
Possible Duplicate: .Net Process.Start default directory? I have a C# application, mono to be

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.