I have a game on a USB drive called MyGame.jar.
It is an executable jar file. I want to be able to put it on cd's and USB drives.
I want the game to start up automatically when the cd or USB is put into the computer, how can i do this?
The game will only be ran on Windows based computers(Windows Xp & Windows 7).
Creating an autorun.inf (Autorun.inf entries) will work quite nicely for a CD.
But for USB drives, as of Windows 7, it can't be done. Microsoft disabled this "feature" because of all the malware that auto-installed that way...
In your case, the contents of autorun.inf should be something like this:
[autorun]
shellexecute=MyGame.jar
icon=MyIcon.ico
label=MyGameName
shellexecute opens MyGame.jar automatically using the jre (if installed). The other lines are optional but good practice.
Here's how to automatically launch an application using autoplay:
Make a text file and save it as autorun.inf. Save it in the base path of the CD.
The contents of autorun.inf should look something like this:
RUN=setup.exe
Icon=icon.ico
The icon field is optional.
Note that this only works if the user has autoplay enabled. If the user disabled it, it won't work.
Related
I work in computational chemistry, so I need to view a lot of files (.cell, .geom, .castep, etc.) using JMol, a .jar molecular viewer. Is there any way I can set these filetypes to open in JMol by default in Windows 10, so that I can simply double click them like I can with other molecule viewers? Obviously setting them to open with Java or the .jar file individually doesn't work, and I can't figure out how to open the files with both.
You can set-up new filetype handlers within Windows Explorer for each filetype you specified, BUT only if you can work out the command that launches JMol to example file of each type as:
C:\absolutepathto\jmol.bat file
You will need to fix your PATH to reference javahome\bin directory and set JMOL_HOME. Alternatively you can edit your version of jmol.bat or make your own a copy of jmol.bat which calls the original with the settings of JMOL_HOME / PATH, or add:
set JMOL_HOME=\pathto\jmol
set JAVA_HOME=\pathto\javahome
rem Replace java ... with:
%JAVA_HOME%\bin\java ...
Then to register these scripts, right mouse on example of each file type and choose -> Properties to see the dialog, click Open with... "Change" and browse to pick your own version C:\absolutepathto\jmol.bat.
Hopefully then at next double-click from Explorer your script is launched. If it doesn't run add this as last line of the jmol.bat:
pause
As I read here: https://github.com/libgdx/libgdx/wiki/Preferences
Preferences files will be saved to ~/.prefs/ (I'm on linux).
When I run desktop app, it works fine, and preferences file is saved to the right place. But with html5, it doesn't save that file! I'm sure it was saved somewhere, because the game still can read it (it contains scores).
My code is really simple, just:
Preferences score = Gdx.app.getPreferences("Highscore");
score.putInteger("score", _points);
score.flush();
I built the game by running
./gradlew html:dist
and run it on localhost created by python
python -m SimpleHTTPServer
then go to http://localhost:8000 on Firefox.
Anyone could help? Thanks for reading, have a nice day.
I found my .prefs in my libgdx html game by running the game in Chrome, right clicking and choosing Inspect Element, clicking on the Resources tab, expanding the Local Storage tab, and examining the entry https://myAppName. This is where the .prefs are kept...
I am trying to change the storage location of Java Web Start. I read that the location is changeable through the java control panel. I got there and I can see the path of my "temporary internet files" but the "change" button is gray. Why can't I change this path? I need to change it to another hard drive.
I googled it for you.
This was my search phrase:
java console change temporary location
And this was the result that was most appropriate:
How to change Cache location for Java on windows 7
Step 1
Find javacpl.exe in C:\Program Files (x86)\Java\jre1.8.0_31("newest version")\bin*javacpl*
Step 2
Right click on javacpl than Properties---Compatibility---choose
run this program in compatibility mode for “Windows XP SP3″
Step 3
Go to
Control panel--Java--General--Setting--Location and Change it.
P.S. Close java control panel before step 1 if its open.
I actually can't believe I'm saying this but since porting my programs to OSX and getting used to permissions, I've realized that what I planned to do on Windows will not work how I want it to. Currently, on windows, my program stores it's setting's in the registry (HKLM) and some user editable resources in a folder next to the program file. For various reasons, I have now decided that the configuration/settings will be stored in a file and the user will be able to in which folder the other resources are kept.
So the question I have now is where to store the configuration file. Obviously it will be updated, but I don't want to program to have to require administrator permissions to run. I would like to offer an option so that all users can use the program (like most programs do), which will of course require Admin, so this leads be onto the second query: where should I store the configuration file (and the folder in which other resources are kept) and how can I detect whether the program has been installed for all users or just one!
Thanks in advance
PS If you didn't guess, the program is written in Java so I would like to know how to programatically get the location you suggest as well please.
Its normal practice in *nix compatible programs to store information in folders starting with name . in the home directory of the users like,
.bash_history
.bashrc
You could use the same on OSX in my opinion and create a directory say,
.myapp
You can store any number of files with any format under that directory.
To get the location of the folder, you can do
String homeDir = System.getProperty("user.home");
File myAppDir = new File(homeDir, ".myapp");
That is roughly the code that can get you your custom config directory for your app.
Please not that dot files / folders are somewhat similar to hidden folders in windows. Your File Manager will not generally show these files / folders by default.
To identify if the program is installed for all the users or not, you could create the configuration at some administrator (root) controlled location like /etc (not sure about Mac) The user configuration can always override the default config. There could be a better way to handle this though.
On both windows and unix, User(usually) has a (home)folder to which it has full permissions. You may create a directory in the home folder and have your user configuration files reside there.
I have an Java application for copying large amounts of data from users' workstations to a server. The java.io.File class is supposed to work with UNC paths very well and in fact it does but only when I run the app in standard execution model.
When the application is launched via Web Start I get a FileNotFoundException when trying to open a FileOutputStream with "The network path was not found" in message. Again everything works fine when I download the jar to the PC and lauch it from command line.
My app is signed and i define all-permissions in JNLP.
Edit: I have also discovered that when I map the UNC path to a drive letter it works too.
There is no solution to this. I ended up mounting the path as a named volume and using it trough the volume.