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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T05:39:54+00:00 2026-06-03T05:39:54+00:00

I have java two projects; one server project and one client project. In my

  • 0

I have java two projects; one server project and one client project. In my network code between the two, I send requests. I don’t want to type 0, 1, 2 for the different types of requests in the code, so I use constants instead. My problem is that I don’t want to declare these constants in both projects, but rather at one place, since the constants are the same for both projects. Does anyone know a good solution for this?

Edit: The client project is an android application and the server is a servlet which should handle requests from clients.

  • 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-03T05:39:56+00:00Added an answer on June 3, 2026 at 5:39 am

    Create a library project with an Interface. This interface declares the constants. Share this library in both projects. If you use some dependency management as in maven this is quite easy.

    EDIT:

    Using a final Class as described in http://en.wikipedia.org/wiki/Constant_interface is better! But the core is, to use a library project and share the common part of both projects in a separate jar.

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

Sidebar

Related Questions

I have two Java Projects. One is a normal Java Project. I want to
I want to be able to have two projects, one that contains production code
I have two java-projects configured with maven. One is a lib to the other.
I have two same web projects(Java) with different name in my workspace. One is
I have two separate java maven projects: one is my web app itself and
I have two java projects in eclipse. Second one is using first one's jar.
I have two Java.io.File objects file1 and file2. I want to copy the contents
I have two Java interfaces and one implementing class. (I have used Eclipse to
I have two Java applications in my network that talk to each other over
So I have a java hashmap like below: hMap.put(1, One); hMap.put(2, Two); hMap.put(3, Two);

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.