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

The Archive Base Latest Questions

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

Some background; I’m quite used to PHP, and I always used something like ‘connect.ini’

  • 0

Some background; I’m quite used to PHP, and I always used something like ‘connect.ini’ where set all my variables to let the PHP script to the database (i.e. the DB URL, the password, the name, and so on); now, I’m taking same classes about Java iee, and the teacher wants us to use runnable jars and connect.bat files, linking them using the ‘String[] args’ in the main function. That is, you write your code and let the method to receive the variables to connect to the database, those variables are set in the main method where they were passed from the command arguments, the main call the method where the variables are needed and the program connects to the DB. the bat file is needed cause you put on it your settings plus the command plus the arguments (in form of environment variables); hope it was clear.

But I’m wondering if this is a good solution, and also if it’s an acceptable solution. My questions:

  • Does this system work on Linux? I don’t believe so. Perhaps a shell script, so we are losing the portability of the code?
  • Why not to use a simply ini file to be put in the resources?
  • How would you rate a teacher who are asking to use this method to assign the variables to connect to the database?
  • Am I wrong if I think he’s putting me in the wrong way when connecting to a database using external useful parameters?
  • 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-28T03:06:27+00:00Added an answer on May 28, 2026 at 3:06 am

    There are a number of ways to supply parameters to the main method. E.G. for an app. launched via. Java Web Start, you would define those arguments in the JNLP launch file. To be a JWS app. means that the app.:

    • Has a GUI
    • Has all resources in a Jar
    • Has a separate JNLP file (and an HTML to link to the JNLP)
    • Is digitally signed if needing to do anything outside the sand-box..

    ..all of which is probably significantly beyond the skills of your classmates right now.

    You are right in believing that a .bat file is not optimal, since it is Windows specific. OTOH, it is one valid way to launch an app. when using Windows, and perhaps the teacher is looking to introduce you to more x-plat methods after this exercise.

    My advice would be to be patient for the moment, but if the teacher introduces more exercises using .bat files to launch Java apps., ask them about other ‘more cross-platform’ ways to launch Java code.


    And just a quick aside on .ini files. Java provides inbuilt support for Properties files, which have a similar format to .ini, but I’m not sure if the Properties class could parse an INI file.

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

Sidebar

Related Questions

Some background: I'm a jack-of-all trades, one of which is programming. I learned VB6
Some background I have a set of data that represents the alchemy ingredients and
Some background: I setup six blogs this week, all using Wordpress 2.92, installed with
Some background: We require all of our DTO objects to be serializable so that
First Some Background I'm planning out the architecture for a new PHP web application
OK some background. I have something similar to this: class ConnectionFactory { public IConnection
Some background: I came across something the other day that got me thinking about
For some background... I have a collection of tables, and I would like a
update: some background - i use the xml file to generate a set of
Some background: I'm writing a policy-based smart pointer (like SmartPtr in the Loki library),

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.