I have some gradle project on java. I know, how to build .exe artifact by Launch4j from .jar. Also I know how to create .msi installer by gradle plugin 'setup-builder' (uses wixtoolset), which installs project folder with java libs and main .jar file inside. Now I want to combine both points but I can't find information how to realise it. Is it possible? If yes - how to do it?
Or maybe is there other way without wix/launch4j?
You can use Inno Setup, which creates an .exe installer. It's very useful because you can include some other program within the installation (like MySQL installer or Java installer). http://www.jrsoftware.org/isinfo.php
Related
how to add hadoop jar file avail in another computer(Ubuntu) using teamviewer, to run java program in windows eclipse.
TeamViewer doesn't affect your Java classpath.
Download the hadoop jar file and add it as a library to Eclipse. Or, better, use Maven/Gradle rather than messing with JAR files yourself.
Ubuntu / Windows doesn't matter. Java is cross platform
I have a Java application that already uses Maven to build automatically. I have tried using IzPack to get my end goal done, but I've been having a lot of trouble with it, so I am open to other options. I need both the installer and the application to be .exe or .bat and not Jar files.
Any ideas are greatly appreciated!
We had the same problem and we came up with the solution to do the build in Maven first creating the exe with launch4j and then we created a plugin for InnoSetup that packages the app and the JVM folder all in one installer.
In the existing projects where I'm working I see that there are Java EE jars like j2ee-1.3.jar existing, but when I try to download from Oracle website (1.6 version) I only see .exe available. So how are they connected, is it like exe after installation will create jar in the installation folder?
I checked the contents of exe with WinRAR but could not find any jar.
Also I have the same question regarding exe of JRE and adding it as external jar to eclipse project.
I suppose you are talking about the JDK installation executable file... So yes you guessed part of the answer, the JDK installation file for windows systems is an executable file that will do nothing but downloading and unpacking the JDK/JRE which is a set of java libraries jars (which you use for your development) in some directories you specify in installation steps.
This is the mains ubject of you question, but note that you will not only find jars when browsing the JDK installation directory, but a lot od other bunch, mains to be cited:
The java process uses for runnig your application.
The javac binary file used for code compilation... and many other staff
.jar is a library /package of Java and when you are on oracle to download it's application of java i.e. jdk or jre.
So when we do programming jars are used to add functionality, we will have to import classes from it.
when we want to use external classes then we have to use it's jar file.
when we do any import like import org.springframework.beans.factory.annotation.Autowired; it came from jar or dependency.
You can make executable jar file of java program, you can find out tutorial for it online. so whenever you click on that executable jar file in any machine where jre is installed you can access it. This is called Executable Jar, and you are telling about Java EE exe is setup application for New Fresh Java Installation.
I have created a java application in eclipse, wich needs comm.jar and jexcel.jar and .property files so i have added to libray. I want to make a jar file out of my java appliction, including the external jar files added to the appliction.
How can I do it? To run serialport programs I have copied win32.dll into java_home/bin and comm.jar into java_home/jre/lib and javax.comm.properties into java_home/jre/lib, but when delivering the product it should run only by needing the jre.
How can I solve this? Please help me.
Thanks in advance,
suma
Although your question is not totally clear I suggest using the Fat Jar Plugin should allow you to achieve what you want.
You can use File > Export > Executable Jar which includes all libraries. There is also a checkbox to generate an ant build file as well as the jar in order to customize it further (I for instance make all the paths relative and remove the main-class flag).
You have two "path" issues. The Java Classpath and the path from which dlls are loaded.
If you were using a Java EE app server or OSGi then controlling these paths is addressed by the respective runtimes. Both Java EE and OSGi are likely to be overkill for small projects.
In which case you are delivering:
Your application JAR
The dependent jars
The DLLs
I suggest that on installing your app you place these artefacts into a suitable directory structure, for example .../myapp/lib for the jars and .../myapp/bin for the dlls. Don't copy them into the infrastructure directories, for example the JRE lib and bin, or into Windows32 - that just leads to version nightmares and mysteries when someone installs a new jre.
Having got that structure, how to control the paths? For the classpath, look at the Manifest.mf file. tutorial
For the DLL path, I know of no good alternative to setting OS level environment variables ** before ** launching the JVM. Hence you need a little batch/shell script to launch your app, setting the PATH appropriately.
You can also check maven.
You can right click on the project and say "Export". Now select "Java" in tree of choices. Under that select "Jar File". It'll guide you through the process and will allow you to export you project as a jar file.
Hope thats what you are looking for.
The recently released Eclipse 3.5 has a Export as runnable Jar which allows to put all dependent jars in a subfolder to the jar file, and get the Manifest right.
It is an adaption of the FatJar plugin. Works nicely!
I have created a Java console application using Netbeans. In the Netbeans dist directory I have the class file of the project. Now I need to give the executable files to someone else
who will run them on another PC.
Which file I should send? How can he run them on his PC? Is there any way to create an exe type file?
Both PCs have the JDK installed.
Build a jar file with a main class specified in it.
If he has Java installed and .jar is associated with that, he should be able to just double-click on it.
Alternatively from a command line he'd be able to run:
java -jar program.jar
There are programs around to create executable wrappers around this, but a jar file is a simpler solution in terms of packaging - it's worth trying that to start with.
In additon to Jons answer:
If you have a runnable jar to start with, it is frequently much easier to package it up in an EXE file. If you have the need search Stackoverflow for JSmooth and one-jar.
NetBeans actually answers your question. If I do a Clean/Build, the output says:
To run this application from the command line without Ant, try:
java -jar "insert_your_project_name_here.jar"
theres a handy page about this here:
java tools tutorial
It describes creating jar files a little further down the page
You can go to run menu and select clean and build project or shift+f11 after this go to dist folder in project folder and use .jar file and run that by hint say in over .