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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T19:26:28+00:00 2026-05-14T19:26:28+00:00

I hate starting a post with this but I’m new to Java… I’ve followed

  • 0

I hate starting a post with this but I’m new to Java… I’ve followed this tutorial to create a socket server (mines in Eclipse). I can run the server within Eclipse, all is well. But when I try to export the project I can’t figure out how to run it. I keep getting this error (it varies depending on how I run it)

Exception in thread "main" java.lang.NoClassDefFoundError: xsocketserver/Main
Caused by: java.lang.ClassNotFoundException: xsocketserver.Main
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:315)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:330)
at java.lang.ClassLoader.loadClass(ClassLoader.java:250)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:398)

I’ve read this problem relates to class paths being set. I’ve tried the following:

java -cp libs/xSocket-2.8.12.jar xsocketserver.Main
java -jar xSocketServer.jar    
java -classpath xSocketServer:xSocketServer/libs/xSocket-2.8.12.jar xsocketserver.Main

plus many others.
The file structure within the JAR is as follows:

xSocketServer.jar
    -> xsocketserver
        -> Main.class
        -> xSocketDataHandler.class
    -> META-INF
        -> MANIFEST.MF
    -> libs
        -> xSocket-2.8.12.jar

Incidentally I’ve tried adding my own manifest file which contains the Class-Path but when I check it it always reads:

Manifest-Version: 1.0
Main-Class: xsocketserver.Main

I’m guessing this is a common problem based on the number of hits I’ve seen in Google but I can’t fathom what I’m doing wrong. Wrong Export settings maybe??

  • 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-14T19:26:29+00:00Added an answer on May 14, 2026 at 7:26 pm

    I don’t believe a jar-file can include another jar (as you’ve included xSocket-2.8.12.jar). If xSocket is your own code, let it be included directly in the “outer” jar instead.

    Check out
    http://www.velocityreviews.com/forums/t143595-jars-containing-jars.html
    and
    Classpath including JAR within a JAR

    Otherwise it looks right to me. Make sure you’re not trying to run an old/stale version of the jar. (Delete the jar and make sure eclipse exports a new one.)

    How are you exporting the .jar file from eclipse? The generated jar-file will usually be based on one of your run-configurations. Make sure you use the one that you use when it works from eclipse.

    Unless you’ve already tried it, try following the steps (listed at the site below)

    http://forums.sun.com/thread.jspa?threadID=5358121

    1-Right click on your project and select export option.A export window will get pop-up.

    2-Select jar file option from the poped-up window which will be in java option of window.

    3-After Clicking JarFile option a new window will get pop-up.

    4-Select the export destination for ur jar file and click next.

    5-After clicking the next a new screen you will see, click on next button again.

    6-Now u will see a new screen which has a field name as “Main Class” browse for your main class of appliaction.main class is once which has main method.

    7-Now select finish.

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

Sidebar

Ask A Question

Stats

  • Questions 419k
  • Answers 419k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I have a similar requirement to extract column names for… May 15, 2026 at 10:16 am
  • Editorial Team
    Editorial Team added an answer Try placing your SqlConnection inside the TransactionScope, it should then… May 15, 2026 at 10:16 am
  • Editorial Team
    Editorial Team added an answer Maybe you should give it a program name to start?… May 15, 2026 at 10:16 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.