programing

Launch4j와 JRE를 번들링하는 방법은 무엇입니까?

nasanasas 2020. 11. 2. 08:04
반응형

Launch4j와 JRE를 번들링하는 방법은 무엇입니까?


내 컴퓨터에 Launch4J가 있으며 훌륭한 프로그램입니다. 내가 관심있는 기능 중 하나는 일반 .EXE 파일에 JRE를 번들링하는 기능입니다. 그러나이 작업을 수행하는 방법을 설명하는 문서를 찾을 수 없습니다.

JRE를 EXE와 어떻게 번들합니까? 또한 어디에서 실행할 수있는 소형 휴대용 JRE를 구할 수 있습니까? Oracle의 다운로드 링크는 설치 프로그램 패키지 용입니다.


몇 가지 시도 후 마침내 내 응용 프로그램에서 jre를 번들로 묶는 해결 방법을 얻습니다.

내 앱을 다음 폴더가 포함 된 zip 파일로 패키징합니다.

containerFolder
|- jre
      |-bin (in bin there is java.exe)
      |-lib
|- cfg (to save the user configuration, but it's not needed)
|- bin (my application with the .exe and the .jar and all the other stuff)

launch4j의 xml 파일에서 다음과 같이 jre를 구성합니다.

<jre>
    <path>../jre</path>
    <opt>-DgvSIG.confDir=../cfg</opt>
</jre>

여기서 트릭은 경로가 java.exe 파일이 아니라는 것입니다. jre의 경로는 .exe의 위치에 상대적이며 java.exe 파일 앞의 한 폴더를 가리켜 야합니다.

내가 사용하는 jre 폴더는 Windows 시스템에 설치된 jre 폴더에서 복사하여 붙여 넣는 것입니다.


당신과 같은 문제입니다. 이제 걱정하지 마세요. 그 모든 것은 미래의 솔루션을 해결하기 위해 최대 깊이로 해결됩니다. 사용자가 Java를 설치하거나 설치하지 않고도 jar 용 JRE번들로 묶을 수있는 방법 입니다. 자바 애플리케이션이 실행됩니다.

  1. 복사 libbin귀하의 폴더 JRE의 프로젝트의 dist 폴더에 폴더

jar에서 exe로 변환

  1. launch4j를 열고 다음 설정을 입력하십시오. 여기에 이미지 설명 입력

트릭은 javaw.exe를 포함하는 전체 경로를 제공해야한다는 것입니다.

즐겨!!!!


나는 다음을 수행했으며 Ver Launch4j 3.11을 사용하여 나를 위해 일했습니다.

  1. 내 응용 프로그램에 대한 새 폴더를 만들었습니다 (예 : MyApp).
  2. Copied the jar file from the java project dist folder to the MyApp along with the lib folder.
  3. Created a folder called jre in my application folder MyApp so now MyApp folder contains:
    • MyApp.jar
    • lib <- this has the libraries needed by my java app.
    • jre
  4. Copied the bin and lib folders from java jre folder (C:\Program Files (x86)\Java\jre7) to MyApp\jre
  5. In the Launch4j having set all the required options, then set the Bundled JRE path to "jre"

    Launch4j JRE 옵션

  6. Make sure that in the search options "Only use private JDK runtimes" is selected.

I have just done this. Above clearly describe the method for bundling jre.

Here, I just share an experience that I have struggled. If you want to create an installer exe after created wrapper exe by launch4j, pay attention to the file path for launch4j and jre. This is my path I used to solve my issues:

launch4j, bin/jre, resources/bin/jre.

launch4j, bin, and resources are at same level.


A working example of using Launch4J to bundle a Java application with a specific JRE can be found at https://github.com/vZome/vzome/blob/master/desktop/platform/windows/README.md. This particular distribution is configured to require vZome to use the bundled JRE rather than any JRE found on the target platform.

Hope this helps.


The jre can usually be found in your SDK folder. Yes the links online are installers, but once it installs, the JRE is now located on your local disk. Mine is located in

${jdk folder}\jre

The parts that you don't need from the JRE could probably be removed manually if you really wanted (I'm not sure whats available online).

참고 URL : https://stackoverflow.com/questions/7071133/how-to-bundle-a-jre-with-launch4j

반응형