Secrets for creating EXE files using jb9 are not disclosed

Source: Internet
Author: User
This article is a non-public use technique of Borland. It can use JBuilder to create EXE files to start java files.
JBuilder does not support local compilation. However, there is a hidden technique that allows you to start a Java program from an executable file, which can appear or does not appear in the console window. Jbuilder.exe jbuilderw.exe (optional) JBuilder. config
JDK. config javalauncher. DLL cmdjbuilder.exe is a common executable shell file used to start Java programs. "jbuilderw.exe" is the same as javaw.exe. It wraps "jbuilder.exe" and does not display the conso le window during running. The key to using these files is the file name. "Jbuilder.exe" looks for a configuration file named "JBuilder. config", which contains the required information to run the Java program.
Similarly, "jbuilderw.exe" finds "jbuilder.exe" to start Java programs without the console window. If you rename "jbuilder.exe" to "foo.exe", "foo.exe" looks for "foo. config "configuration file. Similarly," jbuilderw.exe "is renamed to" foow.exe ", which searches for the" foo.exe "file.
How can I use jbuilder.exe to start an application? Only jbuilder.exe, jbuilerw.exe,
(Or the renamed EXE file) to start the Java application.
The following is an example:
Borland JBuilder 8 is installed in the E:/jbuilder8/directory, and a temp is created under E:/jbuilder8/bin /.
Directory. After that, set the jbuilder.exe, JBuilder. config, javalauncher. dll, and JDK. config files.
Copy to E:/jbuilder8/bin/temp/directory, create a hello directory under this directory, and generate a hello. java file, that is, E:/jbuilder8/bin/temp/Hello/hello. java file,
 
// Hello. Java
Package hello;
Public class Hello {
Public static void main (string s []) {
System. Out. println ("Hello, EXE file! ");
}
}
Compile a Java File
Open the JBuilder. config file and modify it accordingly:
Find the following two lines in JBuilder. config:
# Start JBuilder using the its main class
Mainclass com. Borland. JBuilder. JBuilder
Change
# Start JBuilder using the its main class
Mainclass hello. Hello
Addpath E:/jbuilder5/bin/temp/
The addpath command adds the directory to the class path. This command and other commands that can be identified in config can be found in
In config_readme.txt under JBuilder/bindirectory, find the detailed description.
Then modify the javapath in JDK. config to a relative path. For example
Javapath ../jdk1.4/bin/Java
Modify
Javapath.../../jdk1.4/bin/Java
Modify jbuilder.exeand jbuilder.configto the corresponding file name, for example, foo.exe and foo. config.
So far, modifying JBuilder to use the EXE file to start your own Java application has been completed, but it is fun
Not here, the following tips may be more interesting. Package the JAR file into the EXE file!
Assume that the above file is used to generate the hello. jar package and the execution process is as follows:
Jar CVF hello. Jar Hello/*. Class
Package class files into EXE files
Then, add the jarpackage to the end of jbuilder.exe. the execution process is as follows:
Copy/B ../jbuilder.exe + hello. Jar foo.exe
Convert a jar file to an EXE file:
In the foo. config (JBuilder. config) file, remove the previously added class path and add the following path:
Addpath E:/jbuilder5/bin/temp/foo.exe
Run: foo.exe and you will see that an EXE file containing the jar package has been executed!
The general principle of this process is: the important information of the EXE file is in the file header, so put the mess in the EXE file
It doesn't matter at the end of the file, while the important information of the JAR/ZIP file is at the end of the file, so they are irrelevant and can accommodate
Easy to execute.
However, to use this function, you have to bear the risks that may arise, Because Borland does not provide official support for this function!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.