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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T03:37:14+00:00 2026-06-08T03:37:14+00:00

I’m quite new to java and have a few doubts in setting the classpath.

  • 0

I’m quite new to java and have a few doubts in setting the classpath.
I’ve done my home work before asking the question in this forum. Tried googling and refered other forums, but did not find
what I was searching for.

So, here it goes.

  1. I’m developing a Java application which needs external jars to run properly.
  2. These external jars are available, if and only if a custom application ‘XYZ’ is installed in the system.
  3. Because of licensing issues, I do not want to pack the XYZ application jars in my application.
  4. What my application does is – check if application XYZ is present in the destination host, and runs if it is available.
    Else logs an error stating XYZ is required to run the program and exits.

Now comes the main part…

  1. XYZ application is available for various platforms – Linux / Windows / Solaris / etc.
  2. XYZ can be customized during installation to be installed to custom directory.
    say – D:/XYZ, or D:/apps/XYZ in Windows, /apps/XYZ or /apps/admin/XYZ in linux, solaris etc.
  3. After installing the XYZ application, the jar files will be present in the directory /jars in which XYZ was installed.
    For example – D:/XYZ/jars, /apps/XYZ/jars in *nix.
  4. When the application XYZ is installed in any platform, a new environment variable XYZ_LIB_PATH is created and pointed to
    the respective folder where the jars are present – for example XYZ_LIB_PATH=D:/XYZ/jars is created when the application
    XYZ is installed to D:/XYZ. In the same way, XYZ_LIB_PATH=/apps/XYZ/jars would be created if the application XYZ is installed
    in a linux machine.

Now what I want to do is..

I want to refer my application to the environment variable – XYZ_LIB_PATH and pick up all the jar files present in the directory
pointed by the XYZ_LIB_PATH environment variable of the platform.
By doing this, I need not worry about looking for jar files in each machine when my application is installed. It can just look
into the directory pointed by the XYZ_LIB_PATH variable and continue to run by loading the required jars.

The reason behind this is – since the application XYZ is customizable, each user may have installed it in a different directory
and my application needs to find out where XYZ has been installed. Instead if I use the environment variable, I can get the
required jars easily for my application by looking into the path set for the XYZ_LIB_PATH variable. The user cannot change the
environment variable and hence this variable remains constant across all platforms and I can get a valid path for the jars.

Is there any way to accomplish this in java?

Thanks,
Vinay S

  • 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-08T03:37:18+00:00Added an answer on June 8, 2026 at 3:37 am

    Just provide a startup script for your app:

    java -cp myApp.jar;%XYZ_LIB_PATH%\* com.foo.bar.MyApp
    

    (above example is for Windows. The same can be done on Unix).

    If needed, this script could detect if the XYZ_LIB_PATH environment variable is set and gracefully exit if it isn’t:

    IF NOT DEFINED XYZ_LIB_PATH (ECHO XYZ is NOT installed)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have thousands of HTML files to process using Groovy/Java and I need to
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into
I want use html5's new tag to play a wav file (currently only supported

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.