how to make setup file - java

i have made an application using java....my source is in .java file ...now i want to create a setup file from these source files....
so can anyone tell me how i can make this setup files like another softwares...like device driver....etc...
please co-operate me....

Java can only be run on a machine with a JRE (Java Runtime Environment), so your setup file won't run quite the same as other application setup files; you won't be able to give someone your setup file and expect it to run correctly, unless they already have the appropriate JRE.
However, in Java, the usual way to do the "setup routine" is typically going to result in a "jar" file. Have a look at jar.exe (or "jar" if in linux/unix). It will chunk your classes into the appropriate container.

AdvancedInstaller offers features for installation of Java applications

Perhaps this will help you.

Related

“no sigar-winnt.dll in java.library.path” error when using SIGAR

I'm very new to java. I'm developing a tool that checks if your PC meets some set of specifications. This included writing and executing a separate batch file and including an API (SIGAR) for the model of the CPU.
My problem is that when I tried exporting it to Runnable JAR in eclipse, and I ran the resulting JAR from command line, it gave me lots of 'DLL not included in build path' Exceptions. After including the folder that contains the API DLL in the build path, I got similar exceptions. The thing that fixed it was adding the folder containing the DLL to environment variables (PATH) in Advanced System Settings.
Questions:
The JAR now works fine on my computer, but what about the users who download the JAR? Will they also need to add the DLL to environment variables? If so is there a way the JAR can do that for them?
My JAR won't run with a double-click, but will run from command line. Is there any way around this that will carry over to users who download the JAR too?
If the user downloads the tool and can't run it because they don't have the right version of the JRE, will the tool notify them? If not, is there a way around the user having to update JRE or will wrapping as an EXE suffice?
Thanks in advance, much appreciated. Lots of questions.
Q1: The JAR now works fine on my computer, but what about the users
who download the JAR? Will they also need to add the DLL to
environment variables? If so is there a way the JAR can do that for
them?
You can put a DLL inside a JAR file:
How to make a JAR file that includes DLL files? (Hint: read both answers ... completely.)
However, when you distribute a JAR containing a DLL, you then have the problem that different platforms require different DLLs (or whatever). Even with Windows you have the problem of 32 bit versus 64 bit DLLs.
Q2: My JAR won't run with a double-click, but will run from command
line. Is there any way around this that will carry over to users who
download the JAR too?
You cannot address that problem in a JAR file. The "double-click to run" functionality is implemented by the OS. The best way to provide this kind of functionality is using (platform specific) wrapper scripts that are double-clickable.
Q3: If the user downloads the tool and can't run it because they don't
have the right version of the JRE, will the tool notify them? If not,
is there a way around the user having to update JRE or will wrapping
as an EXE suffice?
Unless you have a JRE installed, the JAR file is just a passive blob of data. (A ZIP file, actually).
If the user has a JRE that is too old, then either the JRE will be unable to load any classes in the JAR (because the classfile version number is wrong), or you will get errors because of missing (system) classes.
The only hope would to do something like providing a wrapper script to launch your application that checked the JRE version before attempting to launch the JAR.
As a general rule, if you want to do fancy stuff like this you need to distribute your program in an installer, not as a bare JAR file.

Java installer with added libraries

I am very new to Java (first-year student). I tried searching for similar questions but can't find anything that exactly meets my needs. I am trying to figure out how to create a JRE installer for Windows that includes additional files beyond the standard libraries. In particular, I am trying to use files from this source: http://jlog.org/rxtx-win.html. I want the RXTXSerial.dll file to go into the "bin" folder, and the rxtxcomm.jar file to go into the "lib\ext" folder.
Ideally, this would be used by a user who isn't good with computers at all, so that all they would have to do is run the JRE installer, and already have the necessary RXTX files needed to run an external application (that I unfortunately don't have any control over).
Take a look at install4j...
https://www.ej-technologies.com/products/install4j/overview.html
Not sure if this is exactly what you're looking for, but you should be able to control what JRE/libs are deployed with your application using this.

How to convert exe application to jar file?

I have exe file called Myapp.exe. Now I want to convert .exe to jar file. That jar file should also work in NON JAVA system. I don't have any idea to implement it. Can anyone please suggest me how to do it?
Direct conversion not available !!!
because they are in entirely different platforms.
Meeting your requirements is impossible for two reasons.
1) You cannot change an EXE to a JAR file.
2) You cannot run a JAR file on a system that doesn't have Java installed.
If you want to run something on a (Windows) system with no Java installation, it needs to be an EXE ... or something else that doesn't require Java.
(It might help if you explained why you think you need to do this. Perhaps there is an alternative set of requirements that are not impossible to meet.)
why i am doing all those stubs is for making my jar has to work in java not installed system.
It needs to be an EXE then!
I have an jar.It is working fine in java installed system.My task is to Bundle jre inside jar(Not along with jar(i.e we can put jre and jar in same folder to run a jar as given in following url mindfiresolutions.com/… ))Because i have to give jar file only to client,in such a way that they can use this Myapp.jar in non java system also.But,i don't know how to bundle jre inside jar.I Don't how to run jre inside jar?
Ermm ...
Is it possible?
No. You cannot embed a JRE inside a JAR file in any way that would allow it (the JAR file) to run your Java code without first installing Java. (And installing Java would defeat the purpose of embedding the JRE ... of course.)
But what you can do is create an EXE file which has a JRE and a JAR embedded in it. And there are tools for doing this. Here's the canonical Question on how to do it:
How can I convert my Java program to an .exe file?
I think you need to read the Oracle documentation on what a JAR file really is, and how Java programs are normally executed. That will help you understand what is feasible ... and what is nonsensical.

Do Java programs natively support the concept of version?

I was wondering if there is any standard procedure to set a Java project's version (a bit like a Windows executable file version).
I'd like to have my application's code able to have introspection capabilities so it can know its own version.
Is it possible, at all, to do this with Java without resorting to have a .txt file in the directory with the version as contents?
If yes, the ideal would be to have Eclipse update the version each time it is compiled. Is this possible?
The Java native way to store version information is in the manifest files (this part of the tutorial is about version information).
You can use the Package class and its methods such as getImplementationVersion to get at those details at runtime.
I'm not sure how to tell Eclipse that I want it to create a .txt file in a given place each time it automatically builds a .java file, though..
Can I suggest that you take a look at Maven, and the release process that it supports.

Java MIDI Synthesizer .jar not playing

I wrote a simple synth instrument gui that works well on my machine. However, as soon as I put it in a jar file, it no longer plays sounds when executing that jar file. I assume that has to do with the soundbank. Either way, I cannot get it to play a note on my machine when I run the jar file, so I presume it will not work on another person's machine. Any thoughts as to what might be going on? Thanks.
-Matt
did you pack in .jar file even sounds that should play?
How do you run your .jar file?
Something about resources in your .jar file (what could be your case) you can read here.
About running .jar files and troubles with them you can read here and here.
Good luck and let us know if it helps you.
You are probably running your tests in an IDE using the java JDK but testing the app from the jar using the JRE.
See on how to fix it: http://www.jsresources.org/faq_midi.html#jre_soundbank

Categories

Resources