This is the use of Borland's non-public use, which can make an EXE file to start the Java file through JBuilder.
JBUILDER 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 in 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 the Java program, "jbuilderw.exe" seems to be 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" finds a configuration file called "jbuilder.config", which contains information that runs the Java program. The same "jbuilderw.exe" finds "jbuilder.exe" to start Java programs that do not have a console window. Rename JBuilder.exe "Foo
.exe "," foo.exe "will look for" foo.config "configuration files, the same" jbuilderw.exe "is renamed" foow.exe ", which will look for" foo.exe "files.
Speaking here, smart readers should guess how to use JBuilder.exe to launch the app. Just rename the JBuilder.exe, JBuilerw.exe, jBuilder.config, specify the primary class and class path in jbuilder.config, and can be started by executing jbuilder.exe (or renamed EXE file) Java app is. Below is this unit as an example.
Borland JBuilder 5 is installed in the E: / JBuilder5 / Directory, build a Temp directory in E: / jbuilder5 / bin /, then copy jbuilder.exe, jbuilder.config, javalauncher.dll, jdk.config four files to E: / jbuilder5 / bin / temp / directory, then build a hello directory in this directory, generate a hello.java file in this directory, ie E: /JBUILDER5/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 into a Class file, then open the jbuilder.config file, 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.hello
AddPath E: / JBuilder5 / Bin / TEMP /
The addPath command is to add a directory to the class path, which can be identified in the CONFIG_README.TXT in the jbuilder / bin directory in the jbuilder / bin directory.
Then modify the javapath in jdk.config into a relative path, for example,
JavaPath ../jdk1.3/bin/java
Modified into 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
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 use the above file to generate a hello.jar package,
JAR CVF Hello.jar Hello / *. Class
Then attach the JAR package to jBuilder.exe,
Copy / b ../jbuilder.exe hello.jar foo.exe
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, foo.exe
have you seen it? An EXE file containing a jar package is executed!
The rough principle of this process is that the important information of the EXE file is in the file head, so putting the chaos and seven-eight-shot EXE files are not tight; the important information of the JAR / ZIP file is in the end of the file, so that they are not coherent It can be easily performed.
Please note: Readers If you use this feature, you have to take your own risk, because Borland does not provide official support for this feature!