Make Installer of java Application - java

I have tried this two setup for making installer of java application.
Exe4j
Inno setup
I have used these 2 setups for making a java application installer.but when I installed on another operating system (Microsoft OS) windows 7 or 8 then its gives error No JVM could be found on your system...
I am stuck in for 2 days.
java application store data into 2 text file and then on text file generate at run time and then delete generated file after some processing. I don't know how should I generate a setup for java application....please anyone?

This might be of interest launch4j. It's possible to wrap applications on Windows, Linux and Mac OS X and can be configured to search for a certain JRE version or use a bundled one

We also have a feature in Advanced Installer, Java edition, that can be used to package your Java application for Windows and for Mac OS.
Here is a 1 minute video that shows how easy it is to build your installer.
Advanced Installer also has the ability to bundle a specific JRE version inside your installer, so your application will use only that JRE, no matter if on the end user machine there is another version of JRE or none at all.

Related

How do I install an earlier version of Java for testing Windows app?

I'm using NetBeans to develop a Windows app that needs to send email. It works when run from Netbeans(NB), but not outside. Specifically, running the created .jar fails to connect. I think the is the default NB Java version is jdk1.8.0_131 (presumably because that was the current JDK when I originally installed NB and began my app development), while Windows C:\Program Files\Java shows jdk1.8.0_131 and jre1.8.0_291. To test this, I'd like to run my NB created .jar file using jre1.8.0_131.
The selected answer to execute JAR file using a specific version of the JRE says I have to download and install "download and install older version." I've mad several attempts to do the latter, but have yet to find the exact download among the myriad of items at Oracle's site. I'm running Windows 10 Pro.
Any guidance gratefully accepted.
Due to a change of Oracle's licences, you can't download older versions of Oracle's java without an Oracle account.
That being said, you probably want to take a look at OpenJDK or AdoptOpenJDK for older java versions.
I got NetBeans 12.4 running on JDK 8 update 131 on Windows 10 as follows:
First note that there are issues with the use of Firefox for this process, so use a non-Mozilla browser such as Chrome or Edge.
Update 131 is a very old release, and (I think) is only available from Oracle via their Java downloads. You will need an Oracle Account (rather than a Cloud Account) to download, so create one now if necessary. Otherwise log in to your Oracle Account by clicking the View Accounts button at the top of the page.
Oracle's installer gets upset and confused if you have some higher update of JDK 8 already installed, so the first thing I did was to remove it through Control Panel > Programs > Uninstall a program. Optionally delete any remaining JDK installation files from disk as well, though that is not essential.
Go to Oracle's web page for downloading old updates of JDK 8 and JRE 8: It's a very long web page titled "Java SE 8 Archive Downloads (JDK 8u202 and earlier)".
To save scrolling, search in the browser for the text "131". You should land exactly where you need to be within the page, on a line titled "Java SE Development Kit 8u131". Scroll down just a few lines to the line for your hardware and O/S combination. In my case this was "Windows x64".
Click the link for the download file specified to the right on that line. In my case it was named jdk-8u131-windows-x64.exe. The browser should download the file, although if you haven't yet logged in to your Oracle account you will be prompted to do so. As long as your credentials are valid the download will still work.
Since you are using Windows, in File Explorer locate the downloaded file in your browser's download folder. In my case the size of the downloaded file was 207,649,848 bytes.
Double click the file to execute it, and run the JDK installer. By default the installer will install the JDK to one of the Program Files directories on Windows, but you can specify an alternative directory if you prefer. If all goes well the install of update 131 of JDK 8 should work, and you will see this screen:
Next, in NetBeans 12.4 open Tools > Java Platforms and click the Add Platform... button to add JDK 8 update 131. It should be shown as a new platform, though not the default one:
At this point, if you don't want or need JDK 8 update 131 to be your default platform (meaning it is the platform that NetBeans itself runs on), you are finished. Otherwise, follow the remaining four steps below.
Next, edit netbeans.conf to make JDK 8 update 131 the default platform. Add a line similar to the one below, but specifying your appropriate path:
netbeans_jdkhome="C:/Java/jdk1.8.0_131"
If there are any other lines in the file starting with netbeans_jdkhome comment them out with a leading #.
Save the file and restart NetBeans.
From Help > About you should see that JDK 8 update 131 is now the default platform:
To start with :
Using any of the older releases form archive is a potential security
risk.
The specific root cause of the real problem 'works with IDE not with jar' may not necessarily be with the major/minor version itself
But since the question you have posted is about how to install older version, my answer would be:
You should first confirm the specific version of Java SE you need. If it's an older version, that should probably be Java 6, Java 7 or Java 8. If you have already faced an issue, you logs would generally show errors pertaining to a version. If yes, cross check with this link for details.
Go to this Java Archive link.
Good to Sign-in at this point or create an account
You will find sections for Java SE, Java EE, Java ME and Java FX. The default Java SE is the one you probably need
Click on the link for the specific version e.g. Java SE 8
That page will show you a list of sections ordered in this form
Ordered by latest update release number
Type (JDK, JRE or Server JRE)
Select the latest on the top with section name starting Java SE Development Kit. E.g. for Java SE 8 search for 'Java SE Development Kit 8u'
In this section select the download for the specific OS version. E.g. Windows x64
Find JDK installation path :
On windows, if you have installed too many JRE/JDK installations and you are unware of the location :
Click Windows key + X, then I
Copy paste text : Get-Childitem –Path C:\ -Include javac.exe -Filter javac.exe -File -Recurse -ErrorAction SilentlyContinue
Using judgement or even date, note the directory that contains the version number you have installed
Make changes how your application runs :
Option 1 :
Right click My computer -> Properties -> Advanced System Properties -> Advanced -> Environment Variables
Below variables to be modified similar to :
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_xxx
JDK_HOME=C:\Program Files\Java\jdk1.8.0_xxx
Append a %JAVA_HOME%\bin to the PATH variable as well
Run
Option 2 :
Install older version of the JDK on a separate machine and copy the folder onto your new hosted machine.
If you jar name is ed.jar and Main class is com.ed.Main then use direct call similar to below :
C:\Program Files\Java\jdk1.8.0_131\bin\javaw -cp ed.jar com.ed.Main
OR C:\Program Files\Java\jdk1.8.0_131\bin\javaw -jar ed.jar
You can't if you never installed Java 7 or if you don't have an Oracle account.
Oracle said that here.

Exporting as stand alone application

I exported Processing application as a standalone application with embedded Java, but the exe does not work in computers where Java/Processing is not installed. Even if the Windows 64 bits works with Java embedded, the 32 bits does not work with Java embedded or not. The computers that do not have Java already installed open the Windows 64 bits exe but not the Windows 32 exe (with java embedded in its exporting process). Here's the post in Processing forum: https://forum.processing.org/two/discussion/25373/no-export#latest
Can it be resolved? Thanks.
You can only include the Java version for the type of machine you're running on.
If you're on a 64-bit Windows machine, then you can only include Java in the 64-bit Windows application. If you're on a 32-bit Linux machine, then you can only include Java in the 32-bit Linux application.
If you really want to include Java for a bunch of different machines, then your best bet is to find each type of machine and do the export from them. Find a 32-bit Windows machine and do the export there, then find a 64-bit Linux machine and do the export there, etc.
You might be able to hack something together by downloading the JRE for each type of machine and manually including it, but that might get pretty tricky. Note that this is not as simple as just copying a folder into your application directory. You're going to have to change the run script file as well.
Shameless self-promotion: I've written a tutorial on exporting applications from Processing available here.

Port Java6 along with application

I have a Java desktop application for Mac, and we are porting Java along with the application. The issue, is that the Java we are using is strictly Java6 and not Java7 (Because Java7 does not have -d32 mode).
So I downloaded Java6 jdk from the apple developer site and have bundled it in the package. And it all works well. But when I try running on other Mac's, then it throws the following error:
/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin
$ ./java -version
dyld: Library not loaded: #rpath/libjli.jnilib
Referenced from: /Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/./java
Reason: image not found
Trace/BPT trap: 5
As per this, it tries searching for the respective directory at /Library/Java/JavaVirtualMachines/ and not in the folder I ported along. How can I solve this issue?
How should I port Java6 along with the application.
Secondly, the Java6 I have used is jdk as I could not find the Jre of Java6. It will be appreciated if someone can provide or share Jre6.
Does Apple licensing even allow their JRE to be redistributed with a third-party app?
I think you are making things harder than they need to be. If a user does not have Java 6 installed (possible in OS X 10.7 and 10.8), the Mac OS will automatically prompt the user to download and install it the first time a Java application tries to run. It will then automatically continue launching your app once it's installed.
Just make sure you are bundling your app appropriately for Java 6 (e.g., using the old Mac Jar Bundler app or manually creating an equivalent Info.plist) and not Java 7 (e.g., using the new Oracle appbundler.jar).

Windows driver installer which installs java native libraries as well

Basically I'm looking to create a silent windows installer which will install Windows drivers and a Java native library (RXTX) which our program use to communicate with the device.
We have drivers for Windows XP, Vista and 7 32bits and 64bits to install. As for the Java native lib, it's only a single file but we have to read the registry first to get the JavaHome path in order to copy the dll at the right place (JavaHome/bin).
I heard about the DIFx framework but I don't know if it can browse the registry and extract a file path from the key. In the other hand, I might be able to just do this with a small C# software but I'm afraid I'll have problems installing the drivers which (AFAIK) needs to be installed in a driver store in Windows vista and 7 but not in windows XP.
Any idea what I could use in order to do this?
I ended up creating a small Visual C++ program which browse the registry using RegGetValue() to find the JavaHome and copy the Java native library in there. As for the driver installation, I used DifxAPI (DriverPackagePreinstall()).
For now I only tested this solution on Windows 7 64-bit but so far it's working as expected.
Most setup authoring tools offer driver support, and can even install Java libraries. Here is a list that can get you started: http://en.wikipedia.org/wiki/List_of_installation_software
After you decide on a tool, try to use it for your package. If you encounter problems you can then ask more specific questions.

Java server jvm installation on windows 32 bit systems

I am trying to bundle java as a part of a java product that should be installed silently with a single click and are having some issues:
My installation has the following requirements:
Has no be silent and require no user input or action excpect a doubleclick on the installation file (no configuration and post install steps)
Has to setup java so that JAVA_HOME points to a Java SE installation with a server jvm
Is this at all possible to do this on a win32 system with sun java installers? I know that by default the jre does not contian a server jvm. But even when installing the jdk the public jre which is installed (and mapped to JAVA_HOME) does not contain a server jvm. In sun own README file (Sun README) they suggest copying the files:
jre\bin\server\
On Microsoft Windows platforms, the JDK includes both
the Java HotSpot(TM) Server VM and Java HotSpot Client VM.
However, the Java SE Runtime Environment for Microsoft Windows
platforms includes only the Java HotSpot Client VM. Those wishing
to use the Java HotSpot Server VM with the Java SE Runtime
Environment may copy the JDK's jre\bin\server folder to a
bin\server directory in the Java SE Runtime Environment.
But this solution is difficult to automate gracefully in a silent install. There has to be a better way to do this without repackaging the entire java distrubution. Has anyone encountered the same problem and come up with a more elegant solution?
For the past years, I manage Java like this: I download the installer, install it somewhere, package all files into a ZIP and then use that ZIP file to deploy Java anywhere. The installer will leave a lot of stuff in the registry and %WinDir%, etc. which you don't really need. This also allows me to move some files around (like the bin\server\jvm.dll or security related settings).
That way, I can even embed Java inside the application directory, independent of any already installed version of Java.
Just set JAVA_HOME in a small batch script before starting your application and you're good. You can use %~dp0 to make it completely position independent (%~dp0 expands to the path leading to the batch file).
Make your own installer.
I use inno setup compiler, works well for my purpose.
If you need the registry entries, you can export them, include them in the installer, include the files, and a little change here and there and you're done. Silent installer that configures things to the exact specifications you need.
It comes with an easy to use script wizard.
I mention a specific one because it's free. Ultimately, making your own installer is the solutions.

Categories