.exe closes as soon as its run - java

I have an exhaustive problem currently boggling me...
I have created a java program through Eclipse and exported to a runnable .jar. Then I have used both Launch4j to create a .exe from it as well as used Inno Settup compiler to create an installer.
Both of these I then copied over to another laptop (Which has Java installed to latest version) I install the Inno setup file and all goes well.
Then when prompted to finish setup and open .exe the program runs and closes just as fast. To be precise the image that I have set as a splash screen flashes once and then closes. I do the same with task manager open and nothing even blips onto the processes panel.
I then proceed to try the same with the Launch4j .exe (It has the .jar in the same folder as the .exe). Same exact behavior as above. Quick flash of splash screen and then closes. Nothing in task manager.
My next step as prescribed by a few other Stack answers is to run via cmd which I do, same story I attempt to run both the newly installed .exe from the Inno setup and the wrapped .exe with exactly the same result and nothing displayed on the cmd window to indicate an error of any kind.
I would much appreciate any help or guidance with regards to this matter? Perhaps someone else has experienced similar?
Extra info.
Virus total returns 0/70 hits for potential threats.
I have made use of only native Java libraries and have no third party packages in the code.
I have not got a certificate as I do this as a hobby for now while I am learning and so have not signed the .exe

So! As an answer to my own question I have discovered what the issue was and will share it here.
Basically boiled down to my jdk/jre being 64 bit and the system needing to be run on being 32 bit.
Easy solution, rewrite program with 32 bit jdk/jre and recompile and it now works perfectly!

Related

Easy way to make a runnable program out of a java project

Im doing a small Java project with some school kids to teach them programming and at the end of this project hopefully we will have a small Game.
I would like to give these kids some sort of "exe" file(on an USB-Stick) that should run if you double click it.
I can produce a .jar file, but that wont execute on double clicking it.
The first thing i can think of is a .bat file with java -jar [game.jar] as content but this would require an installed JRE.
Is there any better(but not too complex) way to generate a file(or directory with file in it) that could run anywhere(on Windows is enough) like a portable JRE?
The best solution would be a single File like a self-extracting zip.
You can use Launch4j, it makes an .exe which tries to run the program and if no JRE is found it leads them to the download page of the JRE. I'm just not sure if it can make an .exe with embedded JRE.
Their website: http://launch4j.sourceforge.net/
Because you are using Java, which is dependent on the JRE to run, you are not going to get around not having the JRE installed without significant legwork. Just package instructions with the flash drives you give the kids!
If you're committed though, look into http://www.excelsiorjet.com/ or http://www.duckware.com/jexepack/index.html.
As well as this SO question: How can I convert my Java program to an .exe file?
I can produce a .jar file, but that wont execute on double clicking it.
Why doesn't this work? Is it an issue with having a JRE present, and that these kids might not have it, or might not be able to install it on other's machines?
I suggest you go here if you want go the "exe" route.
http://www.excelsiorjet.com/free
if you click "free licenses" you can get apply for a free license of I believe the "standard edition."
This should be "Good enough" for your intended purposes, and you wont need a JRE present.
It's more work on your end, but it should work nicely for your needs.

How to make installer for Mac that detects Java version and installs if necessary

I've searched for this answer and I find things that are similar for Windows, but not for Mac. I have an old program that is used on Windows, but not Macs yet. I did not write it, but I have decompiled it to get the code. It looks like it shouldn't be that hard to make it work on Mac, but I want to make a nice installer so my users will want to try it. I have only recently gotten back into the programming game, so I am learning.
I have been investigating how to make a Windows installer that detects the Java version and then installs the correct one if necessary. Is there such a thing for a Mac installer? I have never worked on a Mac so I do not know how its guts work. I have a friend with a Mac who is willing to beta-test for me. I have one lib file that the program needs, plus an icon file. The lib file may need to be changed in the future. It's just a text file. So I would like the icon and the lib file to be part of the package.
I've seen that there is a Java app bundler for Mac, but it's not obvious that it a) checks the Java version and installs the right one or b) that I can include other files in the bundle.
I appreciate any guidance you can give me.

how to make an executable file java using xuggler libraries

I made an executable jar, exporting my project with eclipse.
Its working on my laptop but in another one, it doesn't work. I think because xuggler is not installed on that one.Is there any way to get my software working in others laptops? Maybe I should make the executable file in another way.
Thanks for your time and suggestions.
As of 5.3 (which will be released next week) Xuggler can run on most common operating systems WITHOUT an installer. You will need to include the contents of xuggle-xuggler.jar in your program, but that should be it. Enjoy.
As seen on the xuggler homepage you'll have to install xuggler on every machine you intent to use your program.
Therefore you won't be able to make an independent executable jar.
One solution would be to ship the xuggler install with your program and ask the user if he would install it in order to run your program.

Exported runnable JAR file from Eclipse doesn't seem to execute

(Disclaimer: I am not a Java programmer, and really have very little idea what I'm doing in Eclipse)
I hacked out an application in Eclipse a while back which I finished off and exported as a JAR which runs nicely. I didn't take any notes or make any comments.
The time comes to make some changes to the project but I have to reload it all again because my PC has since been wiped so some settings etc have probably changed.
Anyway it all works and runs nicely from Eclipse. But when I export as a runnable JAR, and double click to run the application, it doesn't seem to execute.
I can see that there is an instance of javaw running, but no window appears. No errors. Nada.
As I said, it works beautifully in Eclipse. Any ideas?
I have little idea of how I can detect what is going on - as I said, I am NOT a java programmer :-)
Ok then, so you can mark the question closed:
If your Java installation is registered for the .jar extension it will try to run the Jar (i guess that's what's happening). But it will do so quietly.
In order to see what's happening (errors and such) you should try to run it from the command line with java -jar myfile.jar.

Executable Jars running very slowly

I've done several projects and packaged them into jar files, but I've noticed that my jar files run much more slowly than in my IDE.
I use Eclipse to compile and run my programs. In Eclipse, I have everything working. When I package my project as a runnable Jar and execute it by double-clicking, everything still works. But when I have animation, the program runs extremely slowly. Instead of 30 frames per second in Eclipse, I now get about 2 frames per second. The animation is very laggy.
Interesting thing is, when I run the same Jar from the command prompt (java -jar MyCode.jar), the lag disappears and my program works as normal.
I currently have no idea what's causing this problem. My computer is running Windows Vista. I'm using the latest version of JRE and JDK. My program contains an animation, nothing fancy.
Thanx
Solution:
There were several different versions of Java on my computer and an incorrect version was used.
The version of java.exe that comes with Windows is very out of date.
By changing the association of the .jar extension to the more recent JVM you should see much improvement.
You may also consider whether any running antivirus software is affecting performance. Some software treats .jar files as the .zip archives that they are and scans accordingly. Their shell integration might explain the difference between double-clicking and command line as well.
Probably you have associated the double click with some "bad" JVM version.
What I would do is to use processxp from SysInternals to see what's the interpreter your app is using. Probably is only matter to change it to use the same as the command line and the eclipse.
Check that and see if both uses the same JVM ( there's a column names command line in ProcessXP, compare that value )
I hope this helps.

Categories