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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T07:09:56+00:00 2026-05-29T07:09:56+00:00

I have built a Java library for Java SE, and recently I’ve used it

  • 0

I have built a Java library for Java SE, and recently I’ve used it in an Android application. I would like to maintain compatibility in the library with both Java SE and Android.

What is the best practice when making a project in Eclipse for this situation? Top of my head, I see three solutions:

1) Create a Java project, and then switch the system library to JRE when I want to compile for Java SE, and to android.jar when it is for Android, but it is kind of a pain.

2) Create two Java projects, one for Java SE and another for Android, and share the same source folder.

3) Use Android as the least common denominator and create an Android project, and use it as a library in Java SE projects.

Is any of these viable? Are there better solutions?

  • 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-29T07:09:57+00:00Added an answer on May 29, 2026 at 7:09 am

    If you have a jar file created using Java SE you can use it directy in your Android project. You just have to be careful not to use anything not supported on Android. For example many of the javax.* libraries are not included.

    In Eclipse you can do Properties->Java Build Path->Libraries->Add External Jar

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

Sidebar

Related Questions

I have built a Java application that has some dependencies (~10). I would like
I have built a web application using Java EE platform that sells one of
Does Java have a built in XML library for generating and parsing documents? If
I currently have a Java testing library which is built with Maven, and distributed
I am developing a domain-specific application library in Java and C#. I'd like suggestions
I have built a multi-touch application which is based on a Java EE backend
I have a Java application, built with eclipse, that uses QTJambi. Running the application
Does Java have a built-in way to escape arbitrary text so that it can
Do Java collections have a built-in method to return multiple items from that collection?
Does Java have a built-in Antivirus? One of my friends told me there is

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.