IntelliJ Idea Development Swing (ii)

Source: Internet
Author: User

Original: Idea development Swing (ii)

Gossip less, book pick Idea Development Swing (a).

After the program is compiled, you need to package the release, if you have Fat_jar students can be packaged through the plug-in, here is the use of ant to package, the steps are as follows:

First, the preparation of Build.xml

<?XML version= "1.0" encoding= "UTF-8" standalone= "no"?><Projectdefault= "Create_jar"name= "Swingdemo">    < Propertyname= "Src.dir"value= "src"/>    < Propertyname= "Build.dir"value= "Target"/>    < Propertyname= "Classes.dir"value= "Classes"/>    < Propertyname= "Jar.dir"value= "${build.dir}/jar"/>    < Propertyname= "Lib.dir"value= "Lib"/>    < Propertyname= "Config.dir"value= "config"/>    < Propertyname= "Plugin.dir"value= "Plugin"/>    < Propertyname= "Db.dir"value= "db"/>    < Propertyname= "Jar_name"value= "App"/>    < Propertyname= "Start_class"value= "Swingdemo." Swingdemomain "/>    <PathID= "Application" Location= "${jar.dir}/${jar_name}.jar"/>    <PathID= "Lib_path">        <Filesetdir= "${lib.dir}"includes= "**/*.jar"/>    </Path>    <Targetname= "clean"Description= "Clear Build">        <Deletedir= "${build.dir}"/>    </Target>    <!--The compilation system has INTELLIJ processing <target name= "compile" description= "compile System" > <mkdir dir= "${classes.dir}"/> <javac srcdir= "src" destdir= "${classes.dir}" encoding= "GBK" classpathref= "Lib_path"/> </target>  -    <Targetname= "Resource"Description= "Initialize resource file">        <mkdirdir= "${build.dir}"/>        <mkdirdir= "${build.dir}\jar"/>        <copydirdest= "${build.dir}\lib"src= "${lib.dir}"/>        <copydirdest= "${build.dir}\config"src= "${config.dir}"/>        <copydirdest= "${build.dir}\db"src= "${db.dir}"/>        <copydirdest= "${plugin.dir}\plugin"src= "${plugin.dir}"/>        <CopyTodir= "${build.dir}"file= "Start.bat"/>    </Target>    <Targetname= "Create_jar"depends= "Clean,resource"Description= "packaged">        <Pathconvert Property= "Mf.classpath"Pathsep=" ">            <Mapper>                <Chainedmapper>                    <!--Remove Absolute path -                    <Flattenmapper/>                    <!--plus lib prefix -                    <Globmapper from="*" to=".. /lib/* " />                </Chainedmapper>            </Mapper>            <Filesetdir= "${lib.dir}">                <includename= "*.jar" />            </Fileset>        </Pathconvert>        <JarDestFile= "${jar.dir}/${jar_name}.jar"Basedir= "${classes.dir}">            <Manifest>                <attributename= "Main-class"value= "${start_class}"/>                <attributename= "Class-path"value= "${mf.classpath}"/>            </Manifest>        </Jar>    </Target>    <Targetname= "Run"depends= "Create_jar"Description= "Run">        <JavaFork= "true"ClassName= "${start_class}">            <Classpath>                <PathrefID= "Lib_path"/>                <PathrefID= "Application"/>            </Classpath>        </Java>    </Target></Project>

Ii. Preparation of Start.bat

Set Path=c:\program Files (x86) \java\jdk1.7.0\bin;%path%-jar Swingdemo.jar

Third, join the LIB package

Due to the layout of the IntelliJ that the program uses, it is necessary to refer to a jar package within IntelliJ, where the jar package is located in:. /intellij idea 12.1.1/lib/forms_rt.jar, copy the jar package to the project's Lib folder.

Iv. calling the ant script

Click the Ant Build button on the plug-in panel on the right side of the IntelliJ idea workspace, click "+" to add the Build.xml file in the project, and you can choose four stages to package the program.

V. Completion of

After the package is complete, the target folder is generated under the project path, the folder contains the program and the required files, click Start.bat to run.

IntelliJ Idea Development Swing (ii)

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.