Sign in to follow this  

JAR files and privileges

This topic is 2839 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I made a JAR file to handle game updating and I've run into some problems with using it. Windows Vista and Windows 7 does not let you write to program files unless the program is run from administrator. The problem comes from not being able to run a JAR file as administrator. Does anyone know how to overcome this obstacle? Thanks

Share this post


Link to post
Share on other sites
JAR files aren't really executables; they're data for the JVM. There's no reason they need to be in Program Files in the first place.

If you really want to "install" your JAR for some reason, or make something that can "update" itself by checking for an update on the web, take a look into JNLP and/or Java Web Start.

Share this post


Link to post
Share on other sites
Hi, thanks for the quick response!

The problem is that any "thing" that writes data to the Program Files folder requires administrator permission. My JAR file is a patcher for a game I made. I pretty much had to go with Java for several reasons:

I spent many many hours and posts on gamedev trying to get my C++ version to work. I have tried using URLDownloadToFile, but that returns values that aren't one of the documented return values (there's 3 if I recall correctly, and the return value isn't always one of those). It works on some computers, not on some. I tried switching to cURL, but couldn't find very good documentation. It worked great on my machine, but required at least 5 or 6 extra dependencies, and would not work well on all systems. I considered python, but I don't know how many people have python installed on their computer, while Java seems to be much more common.

Share this post


Link to post
Share on other sites
Quote:
Original post by Crazyfool
Hi, thanks for the quick response!

The problem is that any "thing" that writes data to the Program Files folder requires administrator permission. My JAR file is a patcher for a game I made. I pretty much had to go with Java for several reasons:

I spent many many hours and posts on gamedev trying to get my C++ version to work. I have tried using URLDownloadToFile, but that returns values that aren't one of the documented return values (there's 3 if I recall correctly, and the return value isn't always one of those). It works on some computers, not on some. I tried switching to cURL, but couldn't find very good documentation. It worked great on my machine, but required at least 5 or 6 extra dependencies, and would not work well on all systems. I considered python, but I don't know how many people have python installed on their computer, while Java seems to be much more common.


What is your game written in and what type of files are you trying to update?

Share this post


Link to post
Share on other sites
C++, I am updating files inside a folder my game created.

The JAR file is in Directory X, and is trying to update files in Directory X. Windows Vista and 7 does not allow this unless the program is run as administrator. This is language independent. It happens with every program I have made.

Share this post


Link to post
Share on other sites
I hate to bump this, but I have NO idea how to do this.

I need a JAR file to be able to write to Program Files folder.. really just any folder the user wants to. The file updates my game, which is often in Program Files. The JAR file wont work since it does not have admin rights. How can I easily avoid/prevent/remedy this for my players?

Thanks!

Share this post


Link to post
Share on other sites

This topic is 2839 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this