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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T15:36:38+00:00 2026-06-09T15:36:38+00:00

I have a Java program, let’s say it’s called MyApp.jar To run it on

  • 0

I have a Java program, let’s say it’s called MyApp.jar

To run it on Linux, I just write a shell script called myapp.sh, which simply runs java -jar MyApp.jar and double click on it. Everything works well.

On Windows 7, I cannot assume that the java command will be in everyone’s path (if that’s what you call it on Windows), so I have to have a workaround and do something like create a batch script with this in it: "C:\Program Files (x86)\Java\jre6\bin\java.exe" -jar MyApp.jar, which is obviously a Bad Solution… and it doesn’t work on XP or Vista. It works on most Windows 7 machines though.

My application ships as a .zip file, the user extracts it to a folder MyApp, and then ideally will double click on something to invoke the program. So far it has a .sh script for Linux users to double click on, and a batch script for Windows 7 users (it works in most cases). It creates and consumes files in its own directory (MyApp).

What is the best way to invoke this program in a cross platform way?

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-09T15:36:40+00:00Added an answer on June 9, 2026 at 3:36 pm

    If you can’t deliver Java with your application, it might be a good solution to use JAVA_HOME to start it. It is set on, well… not all but many systems.
    Definitly you should not use C:\Program Files (x86)… it is much better to use the environment variable %ProgramFiles%

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

Sidebar

Related Questions

Let's say I have a java program that makes an HTTP request on a
I have a java program that performs 5 different tasks. When I run the
I have to write a program (perl , python or java) to simulate workload
I have a .bat script launching a java program. The java program deletes the
Let's say I have two string objects: 25000.00, and 1234 that my program gets
here is my problem with a Java program: I have two classes (let's call
I was trying to execute my java program through shell script so I wrote:
Let's say the bottleneck of my Java program really is some tight loops to
I have a java program that is running in the background(Windows). I would like
I have a Java program that runs many small simulations. It runs a genetic

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.