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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T12:58:10+00:00 2026-06-12T12:58:10+00:00

I have a package with some classes inside D:\ProjectGsc\ . The package root folder

  • 0

I have a package with some classes inside D:\ProjectGsc\. The package root folder is called gsc and contains three subdirectories namely util,core and modules. Inside each of them are some files and inside core there is a file named gsc.class. Apart from those there is also a folder res inside the gsc folder that contains some images that are used by the JFrames and JDialogs inside my package’s classes. I manage to compile everything using -classpath \projectgsc and, as the code has been debugged, everything is compiled smoothly. But I cannot run it at all. I try to java gsc -classpath \projectgsc while I am inside D:\ProjetctGsc\gsc\core\ but it gives me exception in thread main (syntax of main is correct for sure) java.lang.NoClassDefFoundError: gsc (wrong name: gsc/core/gsc). Is it because of the name of my class being gsc inside package gsc.core?

Thanks in advance! (Btw SO does not allow me to name the question “Classpath problem when running” so this is the best title I could come up with, feel free to edit it)

  • 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-12T12:58:12+00:00Added an answer on June 12, 2026 at 12:58 pm

    Yes, to run a class called gsc (which violates Java naming conventions, btw) in a package gsc.core (ick – package name containing the class name; confusing!) you’d write

    java -classpath d:\ProjectGsc gsc.core.gsc
    

    But you’d have to compile it so that you had a directory structure of

    d:\ProjectGsc
                 \gsc
                     \core
                          \gsc.class
    

    You’ll get this automatically if you use the -d option to javac:

    javac -d d:\ProjectGsc *.java
    

    (Adjust accordingly, of course.)

    You may well find that if you’re new to Java, using an IDE which handles all of this for you would make your life easier.

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

Sidebar

Related Questions

I have a package which contains an interface and several classes,some classes in this
I have some classes in my current project which have the wrong package declaration
I have some classes with a protected constructor and the factory method is inside
I have some classes A, B, C in package com.abc I have a Class
I have one java project in netBeans. There are some packages, and classes in
I have next package structure webService.ear -- dependency.jar -- some.class Can I remove some.class
I have an SSIS (2005) package that transforms some XML data and then imports
I have an R package on github that uses a configure script (since some
I have 2 custom objects: 'Package' and 'Order'. 'Order' includes 'Package' field and some
We have some code kicking around that uses this old internal Sun package for

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.