These two days have encountered some problems in packaging a Java project into an EXE file, and now write down these problems and solutions.
1, the background image cannot be displayed when using Java Swing as the front end
Solution: Convert JPG images to PNG images ..... (I really don't know why.) Tortured me for two days)
Create a new folder under the SRC folder for the project image to use in the project, you can hit the jar bag when the picture into the.
Methods for generating an IMG object:
2. Use exe4j to make jar package into EXE package, error.
Solution: Tried a variety of tutorials did not succeed, was forced to translate the error log, and then found that may not be the external jar package to play near the EXE package. Backstage program is written by brother, I do not quite understand what those external packages are, possibly similar to Python's external library? Anyway, when adding the jar package, put the external reference jar underneath the Lib folder under project into it, and you're good to go.
3, the JRE to close the problem of EXE package.
Solution: In fact, we did not implement the JRE into the EXE package. My understanding is that it should be a relative path that stores the JRE. For example, I hit the EXE package in the path of the JRE is./jre1, and just brother is./jre2 or something like that. When you copy a well-played EXE package to another desktop without a JRE package, our EXE file cannot be run. and the Jre2 folder copied to the desktop, just brother's EXE file can run, and I can't run. After copying the jre1 files to the desktop, I can also run. Therefore, the EXE must be loaded with the JRE package this tail, and the JRE package needs and EXE files in the same root directory. But looking at blogs seems to mention a simplified approach.
4. The relationship between Jdk10 and jdk1.8
There is no solution to this problem. I am under the official website jdk10,exe4j Software says cannot find the JDK environment. Then change the JDK10 to 1.8, you can run the exe4j normally. Is it because EXE4J does not support the latest version of the JDK or jdk10 and jdk1.8 have any other differences?
Some questions about Java project to play EXE package