I'm trying to turn a java program into a mac .app file, or more accurately, a native mac application. This requires a .plist file (see here) but I can't seem to find anywhere that works in telling me how to make one. I set up the directories as they specified, and my application debugs properly. Its just every time I try to open the application, it immediately shuts down. Does anyone know how to make a (minimalist even, for now) working plist file?
Right click on your project and select Export. Assuming you on using a Mac, there will be an option to output an application bundle.
Once you have created the app bundle (which itself is just a directory), go here to find the Info.plist file:
MyApp.app/Contents/Info.plist
From there you can edit the plist, if you need to.
Related
I have a Java program that I've made which opens and uses .project files. As long as I open the files from within the program everything works fine. However I want to be able to install the program and register (maybe even maintain) file association so that when the user will double click on a .project file one of two things will happen:
If the program is not running, the program will launch and will have the file path (complete with name and extension) passed to it so it could open the clicked file.
If the program is already running, do not open a second instance of the program but rather pass the file path (complete with name and extension) to the program so it could open it.
I've scoured the internet and found things such as:
The Java™ Tutorials
and
Stack Overflow - inno setup file association
but these answers are confusing. They talk about using external programs (is this necessary?) and don't explain properly how to accomplish file association in them or talk about Ant code while building in Netbeans (which I am using) but I don't really understand how to start Ant code, if I need to add it, add a new .xml file to the project or whatever.
I've tried manually associating my built JAR file in the Windows association list but it will not accept it. I am guessing I need it installed and/or converted somehow into an .exe.
In any case I want to distribute the program to others and so it needs to be done automatically.
I would prefer to have this work on multiple platforms but I am most concerned with this working on Windows (Windows 10).
I have installed a Java Application[which creates slides presentations like powerpoint] on my computer. It runs successfully from start menu. But when I Open the file created in that application, it does not opens, application does not launches. Somehow those files can't find the path to that application. does anyone have any idea what possibly could be the issue? I am using windows 7.
Windows uses file associations to know which application can handle which file type.
These associations aren't created by magic; either an installer creates them or you need to create them manually. When you right-click the file and select "Open", Windows should ask you which application to use. Select your Java app and it might work.
"Might" since some applications don't accept command line arguments. That means Windows can't tell the app which file to open. If that's the case, then you need to launch your app manually and then open the file from within the app.
Related:
Add a new file association in Windows 7
Whenever I unpack dmg installer I see image containing launcher something like - "Installer - spring-tool-suite-3.6.0.CI-B1808453-e4 ". After I try to launch this installer the loading indicator hangs a little, disappears and nothing happens. I am being forced to migrate to Mac OS due to work environment. I can't even launch the installer.
I suspect this is due to default Apple Java (whatever that means I am not OS X expert) being deleted on this laptop and JDK8 is on the home path.
ALE:~$ echo ${JAVA_HOME}
/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/
Well, this forces me to migrate to IntelliJ, but I can't just believe that because of someone else fashion I can't do the work usual way...
Any hint? I don't even get error message..
Had the same issue - download .tar.gz instead of .dmg distribution. There (sts-bundle/sts-3.X.X.RELEASE/STS.app) you'll have STS.app it should run.
Since there is an interest around the question I will post the valid solution. Now what I did which caused an error - deleted default mac os java, and installed java 8 as HOME. Now Eclipse (STS, JasperSoftStudio or whatever) which was installed using dmg will look up the java not anywhere near your HOME directory. (even if it is inside Library as it should be).
Solution: Go to eclipse distribution directory (typically under applications) find the launcher, right click on the launcher, "show package contents", go to MacOS folder, open the .ini file(will have different name for different distributions) and locate -vim entry which statically points to some mac os location attempting to find java lib which is not there and never should be. Make sure your java home path is set, as now it will start to behave normally and look up home path.
If this still did not fix the issue, attempt to delete workspace folder if left from previous installation(or rename it) and play with Locked/Unlocked on the launcher properties. However the last two options are rather dances around the fire to summon spirits. The first suggestion should work 100%.
Make sure the error we are solving is something like: "Unable to locate plugin bla bla" in the error log.
All the best.
I'm into a very strange issue that's making me crazy .-.
I'm working on a relatively big Java project on Windows, using NetBeans and IzPack to prepare the graphical installation package.
Everything is ok, the compiled installer seems to work and my program is copied in 'C:\Programs\MyProject' folder.
But... when I double click on the myproject.jar in that folder it doesn't start at all. I obviously tried to open a prompt and type 'java -jar myproject.jar' but nothing, not even a line of error code.
The curious facts are two:
if I open it using the prompt with administration rights it works
in the same folder there is another jar, 'uninstaller.jar' created by izpack, and it works with double click.
I double checked my JVM installation, the PATH/JAVA_HOME/... values, and Properties->Security tab of my JAR but the permissions to execute/read/write for every kind of user are ok, and also are equal to the uninstaller.
So what's the problem? Thanks
This is almost certainly caused by Windows UAC on Vista and Windows 7.
Your program is probably trying to write to data files in the same directory as it is installed.
On Windows, well behaved programs write to the users or all users app data directory.
The location of that directory varies depending on the version of Windows.
You can use the system property "user.home" to find a safe place to store data.
You can also get a list of environment variables for shared and per user program data folders from here.
Here is the scenario. I have an application which writes a configuration file in its directory (user.dir). When the user cannot write to that directory due to UAC issues, I would like to change that to write to user.home/.appname/. The problem is that Windows really lies to my application and writes to user.dir which is in the Program Files directory, but although it allows the write and the read (even after restarts) it doesn't store it there, it stores it in a hidden directory (the home directory/AppData/Local/VirtualStore/Program Files/appname), making it hard/impossible for the user to find if they want to edit the file.
However, I don't want to just change my application to write to user.home and be done with it because some users run the application off of a USB drive, at which point I want to use user.dir if it is available, because it would not be helpful to leave things around the user home directory in that scenario (on a guest computer).
So after that rather long winded background, is there a way from java to know if the local directory is really truly directly writable from Java or if vista is going to instead virtualize the directory writes to another location?
This problem occurs if the Java executable is not marked as Vista compatible (using the manifest). The current release from Sun is marked as compatible. So the simplest solution is to use the latest release. This means that now neither files nor registry entries are virtualised.
Edit from author of OP:
Java 6 Update 10 (bug 6722527) added the manifest to the relevant files. Bug 6737858 addressed further issues, and is recorded as fixed in Release 12, although it is not in the release notes. For JDK 1.5, the installer was fixed in Update 11, however there will be no manifests added to the exe by Sun. You can add one yourself by putting the manifest file in the same directory as the exe if it is important enough.
After writing your file, can you just check that the file suddenly appeared in virtualized directory? I'd do a small "touch" file at app start to set a global boolean variable userUserHome.
Prepare a native EXE that loads the JVM in process (java.exe does this but you will need your own).
Add a manifest file (or in RC data) that specifies UAC as invoker.
Try writing to the folder to see if it works.
Or decide this is too much work and use a config file.