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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T17:11:31+00:00 2026-06-06T17:11:31+00:00

Update : Here is the project. I have the following directory structure: RMI |

  • 0

Update: Here is the project.

I have the following directory structure:

RMI
  |
  api.jar
        |--> org.examples.rmi.api.Pi
        |--> org.examples.rmi.api.Task
        |--> org.examples.rmi.api.Compute
  client.jar
        |--> org.examples.rmi.client.ComputePi
  server.jar
        |--> org.examples.rmi.server.ComputeEngine
        |--> org.examples.rmi.api.Pi
        |--> org.examples.rmi.api.Task
        |--> org.examples.rmi.api.Compute

I typed the following commands to start my server:

C:\Users\Public\RMI\server>set CLASSPATH=
C:\Users\Public\RMI\server>start rmiregistry
C:\Users\Public\RMI\server>java -Djava.rmi.server.codebase="file:/C:/Users/Public/RMI/compute.jar" -Djava.rmi.server.hostname=127.0.0.1 -Djava.security.policy=server.policy org.examples.rmi.engine.ComputeEngine

Then I typed this command to start my client:

C:\Users\Public\RMI>java -cp api.jar -jar -Djava.rmi.server.codebase="file:/C:/Users/Public/RMI/api.jar" -Djava.security.policy=client.policy client.jar 127.0.0.1 45

But I get the following error:

Exception in thread "main" java.lang.NoClassDefFoundError: org/examples/rmi/api/Task
        at java.lang.Class.getDeclaredMethods0(Native Method)
        at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
        at java.lang.Class.getMethod0(Unknown Source)
        at java.lang.Class.getMethod(Unknown Source)
        at sun.launcher.LauncherHelper.getMainMethod(Unknown Source)
        at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
Caused by: java.lang.ClassNotFoundException: org.examples.rmi.api.Task
        at java.net.URLClassLoader$1.run(Unknown Source)
        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)
        ... 6 more

But if I add the three classes that are in the api package to the client.jar file, the client works.

I get the same NoClassDefFoundError if I remove the same three classes in the server.jar file, even though I set the classpath to api.jar.

C:\Users\Public\RMI>java -cp api.jar -jar -Djava.rmi.server.hostname=127.0.0.1 -Djava.rmi.server.codebase="file:/C:/Users/Public/RMI/api.jar" -Djava.security.policy=server.policy server.jar

I don’t want to put the three classes in the api package in multiple places. I just want to keep them in one place, in the api.jar file. Am I not setting the classpath on the command line correctly?

Your advice will be greatly appreciated. Thanks!

  • 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-06T17:11:32+00:00Added an answer on June 6, 2026 at 5:11 pm

    The -cp argument is ignored when you use the -jar option. You should be using the Class-Path option in the Manifest of client.jar to connect client.jar to api.jar.

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

Sidebar

Related Questions

I have a project structure that looks like the following: [Solution Name] doc (documentation)
I have following query in my project, $values = array(test=>value) $this->_db->update(tablename,$values,array('id = ?'=> $data['id'],'wid
I have the following form: <%=form_for [:project, @permission], :url => { :action => update
A very strange thing indeed. I have the following project structure: myproject/one/two Inside package
here's my question: I have an MVC3 C# application and I need to update
I have simply donwloaded JSW community edition, unwrapped into a directory: c:\servicetest So here
So I have a maven project which produces a jar package containing some ant
I'm trying to setup a test Django project on Heroku. Following the advice here
Here's the scenario: I have a git project open in eclipse + egit (the
UPDATE: Based on suggestions here, I've modified my code. To get a handle 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.