Use JBuilder to make EXE files (Baiyun original)

zhaozj2021-02-11  227

If you say the title, I thought JB really provided a mainstream method for packing the Java application into an EXE file.

,

You will be disappointed, and a small trick below is just a skill.

Use JBuilder to make executable - Baiyun Huanghe Jack

This is the use of Borland's non-public use, which can make an EXE file to start the Java file through JBuilder. JBUI

LDER does not support local compilation mechanisms. But there is a hidden tip that allows you to start Java programs from an executable file.

You can appear or do not appear the Console window. I want to do this, I need these files in the bin directory of jbuilder:

JBuilder.exe

Jbuilderw.exe (optional)

JBuilder.config

JDK.config

Javalauncher.dll

"Jbuilder.exe" is a universal executable shell file for launching a Java program, "jbuilderw.exe"

it is good

Like Javaw.exe, it puts "jbuilder.exe", but does not show that console when running

window. The key to using these files is the file name. "Jbuilder.exe" Find a file called "jbuilder.confi

G "configuration file, which contains must be information that runs the Java program. The same" jbuilderw.exe "Find" JB

Uilder.exe "to start Java programs without a console window. If jbuilder.exe is renamed" foo.exe

"," Foo.exe "will look for" foo.config "configuration files, the same" jbuilderw.exe "is renamed

"Foow.exe", it will look for "foo.exe" files.

Speaking here, smart readers should guess how to use JBuilder.exe to launch the app. Just put jbuilder

.exe, jbuilerw.exe, jbuilder.config renamed the corresponding file name, specified in jbuilder.config

Class and class paths can start Java applications by performing jBuilder.exe (or renamed EXE files)

In

. Below is this unit as an example.

Borland JBuilder 5 is installed in the E: / JBuilder5 / Directory, build a TEMP under E: / JBuilder5 / Bin /

Catalog, then copy jbuilder.exe, jbuilder.config, javalauncher.dll, jdk.config four files

Under the E: / jBuilder5 / Bin / Temp / Directory, then build a hello directory in this directory, in this directory

Born

It is a hello.java file, that is, E: /JBUILDER5/bin/temp/hello/hello.java file,

File: //hello.java

Package hello;

Public class hello {

Public static void main (string s []) {

System.out.println ("Hello, EXE FILE!");

}

}

Compile into a Class file, as shown in Figure 18-14:

Figure 18-14 Compiling all Java files

Then open the JBuilder.config file to make a corresponding modification:

Find the following two lines in jbuilder.config

# Start JBuilder Using The Its Main Class

Mainclass com.borland.jbuilder.jbuilder

change into

# Start JBuilder Using The Its Main Class

Mainclass hello.helloaddpath E: / jbuilder5 / bin / temp /

The address command is in the class path, which can be identified in JBU in this command and other config.

Detailed descriptions are found in config_readme.txt in the iLder / bin directory.

Then modify the javapath in jdk.config into a relative path, for example,

JavaPath ../jdk1.3/bin/java

changed to

JavaPath ../../jdk1.3/bin/java

At last

Modify jBuilder.exe, jBuilder.config to the file name required, such as foo.exe and foo.config files

.

Execute the foo.exe file now

The results of the execution are as shown in Figure 18-15:

Figure 18-15 Run results after foo.exe

At this point, you have completed it by modifying JBuilder to start your own Java application using the EXE file.

But the fun place is not in this place, the following tips may be more interesting, pack the JAR file into the EXE file!

Assume that the above file is used to generate the Hello.jar package, the execution process and the operation result are shown in Figure 18-16:

JAR CVF Hello.jar Hello / *. Class

Figure 18-16 Pack the class file into an EXE file

Then attach the JAR package to jBuilder.exe, the execution process is shown in Figure 18-17:

Copy / b ../jbuilder.exe hello.jar foo.exe

Figure 18-17 Transforming the JAR file into an EXE file

In the foo.config (jbuilder.config) file, remove the class paths added before and add the following path:

AddPath E: /JBUILDER5/BIN/Temp/foo.exe

Then execute, the results are shown in Figure 18-18:

Foo.exe

Figure 18-18 execution results of JAR file becoming an exe file

have you seen it? An EXE file containing a jar package is executed!

The rough principle of this process is that important information from the EXE file is in the file head, so puts the chaos and seven-eight-weeks.

The tail is not tight; the important information of the JAR / ZIP file is in the end of the file, so that they are not coheed,

Capacity

Easy is performed.

Please note: If the reader uses this feature, he has to bear the risk that it may bring, because Borland is not

mention

Official support!

转载请注明原文地址:https://www.9cbs.com/read-5199.html

New Post(0)