Ref: http://java.chinaitlab.com/Eclipse/812775.html and http://www.javavids.com/video/how-to-create-an-executable-jar-file-in-eclipse.html

  Right now your project is bunch of java files in Eclipse. But usually when you finish your application, you want to create a runnable file, so that somebody else can execute it. How to do that?

  1)First you must test run your application in Eclipse. This will create a run configuration, which we'll use later.I have here two applications.One is a console application and the other is a gui application.To create a runnable file, you must

  2)right click your project and

  3)choose export. Choose

  4)Runnable Jar file and

  5)click next. There you must

  6)choose your launch configuration, which is the same as run configuration created earlier.

  7)Type export destination jar file. And choose what to do with libraries, that your application use. I

  8)usually choose to copy libraries into a subfolder. Click finish.Now we'll go to the output folder. Here you can run your application in two ways.

  9)If your application is a gui application, you can click on jar file and it will run. If it's a console application, you must open command line and type java minus jar and jar filename.

for instance, my console app is export to my path"H:\OwnTool\RemoveFileToDirectory\Mover.jar",so my command prompt is :

  

 java -jar H:\OwnTool\RemoveFileToDirectory\Mover.jar

  By the way, what is jar file anyway? It's an ordinary zip archive, where are packages with class files and META-INF directory with manifest mf file. In this file is mainly defined application classpath and a default main class to execute if you want to run this application.

在eclipse中将java导出为可执行文件.的更多相关文章

  1. Eclipse中将项目导出jar包,以及转化成exe的方法

    Eclipse中将项目导出jar包,以及转化成exe的方法 http://wenku.baidu.com/view/385597f07c1cfad6195fa7c6.html

  2. 怎样用Eclipse将Java源代码生成可执行文件[转]

    eclipse将java源代码生成jar可执行文件 用eclipse做了一个web项目的自动化测试,自己用的时候倒是很方便,打开eclipse直接运行即可,但是分享给其他小伙伴用的时候就不太方便,希望 ...

  3. Eclipse中将Java项目转换成Web项目的方法

    前言: 用Eclipse开发项目的时候,把一个Web项目导入到Eclipse里会变成了一个java工程,将无法在Tomcat中进行部署运行. 方法: 1.找到.project文件,找到里面的<n ...

  4. eclipse中将Java项目转换为JavaWeb项目

    eclipse导入一些war项目后,会以java项目形式存在,因此我们需要将java项目转换成web项目,不然项目也许会报错. 1.右键已经导入的项目,选择properties. 2.选中projec ...

  5. Eclipse中将Java项目转换成Web项目的方法(转)

    前言: 用Eclipse开发项目的时候,把一个Web项目导入到Eclipse里会变成了一个java工程,将无法在Tomcat中进行部署运行. 方法: 1.找到.project文件,找到里面的<n ...

  6. eclipse中将java项目变成web项目

    今天,用Eclipse开发项目的时候,把一个Web项目导入到Eclipse里会变成了一个java工程,将无法在Tomcat中进行部署运行. 方法: 1.找到.project文件,找到里面的<na ...

  7. Eclipse中将java类打成jar包形式运行

    记录一次帮助小伙伴将java类打成jar包运行 1.创建java project项目 file > new > project > java project 随便起一个项目名称,fi ...

  8. 使用Eclipse把java文件打包成jar 含有第三方jar库的jar包

    使用Eclipse把java文件打包成jar 含有第三方jar库的jar包   网上打包说用eclipse安装fat jar插件,但是貌似现在都不能用了,所以我只能按照eclipse自带的方法打包了. ...

  9. Eclipse将Java项目打成jar工具包

    jar包:就是别人已经写好的一些类,然后将这些类进行打包,你可以将这些jar包引入你的项目中,然后就可以直接使用这些jar包中的类和属性以及方法. jar包可分为可执行jar包和jar工具包,在这里, ...

随机推荐

  1. insert时出现主键冲突的处理方法【转载】

    原文出处:http://hi.baidu.com/ytjwt/blog/item/1ccc2c26022b0608908f9d8c.html 使用"insert into"语句进行 ...

  2. 如何在jasperreport自动生成序号

    在导出报表时,有时候我们需要显示序号,有两种方法: 1.就是再加一个字段,就是说将序号也当做是要导出的字段来处理,然后用程序给这个字段赋值,这方面有点傻,就不说了. 2.利用jasperreport提 ...

  3. php-Mysql示例1

  4. Spark RDD Persistence

    Spark最为重要的特性之一就是可以在多个操作(Action)之间,将一个或多个RDD关联的数据集(Dataset)以分区(Partition)为单位进行持久化(Persist)或缓存(Cache), ...

  5. Ubuntu学习笔记-win7&Ubuntu双系统简单搭建系统指南

    win7&Ubuntu双系统简单搭建系统指南 本文是自己老本子折腾Ubuntu的一些记录,主要是搭建了一个能够足够娱乐(不玩游戏)专注练习自己编程能力的内容.只是简单的写了关于系统的安装和一些 ...

  6. KiCad中层定义

    5.2.1. Paired layers The Adhesives layers (Copper and Component):    These are used in the applicati ...

  7. google、baidu高级搜索技巧

    1.baidu(可以去高级搜索查看更多信息) intitle搜索范围限定在网页标题:intitle:和后面的关键词之间不要有空格----intitle:中国 site搜索范围限定在特定站点中:“sit ...

  8. UVa12063 Zeros and Ones

    神坑 1竟然还要取模 在后面填数多好的 #include<cstdio> #include<cstring> #include<cstdlib> #include& ...

  9. 3proxy 二级代理配置样例

    适应情况: 有时,我们的机器HOST-A只能通过代理服务器HOST-B才可以访问internet, 而与我们相连的机器HOST-C也需要访问internet, 但是HOST-C却不能直接访问HOST- ...

  10. 【Android - 框架】之Retrofit的使用

    Retrofit是Square公司发布的一个可以应用在Android和Java中的Http客户端访问框架,其底层应用的是OkHttp. 在这个帖子中,我们以下面这个Http请求为例: https:// ...