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. Warm up 2

    hdu4619:http://acm.hdu.edu.cn/showproblem.php?pid=4619 题意:题目大意:给你两种纸牌 ,一种水平放置共有n张 ,一种竖直放置共有m张.水平放置的纸 ...

  2. 客户端(C#)调用CXF搭建的webservice的出现一些问题记录

    最近把XFire框架搭建的一个webservice换成CXF框架.访问webservice的客户端是C#写的.客户端调用webservice,数据能在客户端得到.看起来显然是成功了. 但其中在VS中添 ...

  3. SQL server 变量、运算符

    一.三个表的练习 表一:学生表 student学号:code int (主键)从1开始姓名:name varchar(50)性别:sex char(10)班级:banji char(10)语文教师编号 ...

  4. 【HDOJ】1429 胜利大逃亡(续)

    BFS+状态压缩,做了很多状态压缩了.今晚把八数码问题给搞定了. #include <iostream> #include <queue> #include <cstri ...

  5. activiti集成drools实验

    无代码,无真相. 网上的博客代码,都挺片段的.所以,我想找个现成的demo实验代码. 上github ------------------------------------------------- ...

  6. [ReadingNotes] Search the links, static final in the java

    [ReadingNotes] Search the links, static final in the java */--> pre { background-color: #2f4f4f;l ...

  7. [LeetCode] Longest Valid Parentheses 解题思路

    Given a string containing just the characters '(' and ')', find the length of the longest valid (wel ...

  8. poj 2449 第k短路

    题目链接:http://poj.org/problem?id=2449 #include<cstdio> #include<cstring> #include<iostr ...

  9. MySQL表设计基础

    MySQL表设计关于blog数据库中建立所有表的sql语句<一.>sql语句中 约束概念constraint concept1.1 实体完整性entity integrity(主键--唯一 ...

  10. C#中HashTable的用法示例1

    一,哈希表(Hashtable)简述 在.NET Framework中,Hashtable是System.Collections命名空间提供的一个容器,用于处理和表现类似keyvalue的键值对,其中 ...