When a java project needs to be transfered to another machine, e.g. vps, we need to export it to a runable jar and then run it directly on a new machine.

right click project in eclipse, and export to a runable jar. Choose the second Library handling option and set the entry point with a class including main function. After that, we got a jar file and make sure the libraries are declared in MANIFEST.MF file. Then we need to create a empty folder and copy this jar file along with other resource files (e.g. figures, configuration files) into the folder. Now, we can copy this folder to other machine, and run it with the command: java -jar project.jar.

PS: it is said that if there is no other jar file in the project, then we choose export the java project to a jar. Otherwise, we choose export the java project a runable jar (the library information will be automatically generated in MANIFEST.MF).

export a java project to runable jar的更多相关文章

  1. 将java project打包成jar包,web project 打包成war包的几种演示 此博文包含图片

    转: http://blog.csdn.net/christine_ruan/article/details/7491559 http://developer.51cto.com/art/200907 ...

  2. 将java project打包成jar包,web project 打包成war包的几种演示

    将java项目打包成jar 第一种:MyEclipse将java项目打包成jar. 1,右击项目,选择export . 2,点击Java,选择JAR file . 3,在JAR file文本中浏览打包 ...

  3. java project打包生成jar包(通用)

    1. 在工程目录下新建一个build.xml文件,如下图所示,注意必须是在工程目录下,而不是在工程目录的src目录里. 2.编写ant脚本,内容如下,jar文件名称(com.anllin.rup.bo ...

  4. java项目(java project)如何导入jar包的解决方案列表

    右键项目-properties-java build path(左侧菜单)-选择libraries 有两种方式,导入jar包实际上就是建立一种链接,并不是copy式的导入 一.导入外部包,add ex ...

  5. eclipse项目(java project)如何导入jar包的解决方案列表?

    右键项目-properties-java build path(左侧菜单)-选择libraries 有两种方式,导入jar包实际上就是建立一种链接,并不是copy式的导入 一.导入外部包,add ex ...

  6. 将java项目打包为jar

    打开Eclipse,点击file,选择export 选择java,选择其中的JAR file并点击next 选择需要的到处的项目,并在下方输入将项目保存为的目录,文件名字. 如果,已经将项目打包为一个 ...

  7. Eclipse集成Maven环境(出现jar的解析或者缺失问题)(或者出现Invalid classpath publish/export dependency /common. Project entries not supported)的统一整理

    在正确配置完Maven,和Maven IntegrationFor Eclipse之后,新建了一个Maven Project 和一个Maven Module,发现新建的Module项目下的pom.xm ...

  8. java代码打包成jar以及转换为exe

    教你如何把java代码打包成jar文件以及转换为exe可执行文件 1.背景: 学习java时,教材中关于如题问题,只有一小节说明,而且要自己写麻烦的配置文件,最终结果却只能转换为jar文件.实在是心有 ...

  9. Eclipse将引用了第三方jar包的Java项目打包成jar文件的两种方法

    方案一:用Eclipse自带的Export功能 步骤1:准备主清单文件 “MANIFEST.MF”, 由于是打包引用了第三方jar包的Java项目,故需要自定义配置文件MANIFEST.MF,在该项目 ...

随机推荐

  1. 内存屏障 & Memory barrier

    Memory Barrier http://www.wowotech.net/kernel_synchronization/memory-barrier.html 这里面讲了Memory Barrie ...

  2. ROS学习笔记(八)——ROSTOPIC

    NEW 1 $ roscore NEW 2 $ rosrun turtlesim turtlesim_node NEW 3 $ rosrun turtlesim turtle_teleop_key N ...

  3. 推荐两本学习linux的经典书籍

  4. css学习记录

    1 !important 表示此属性需要优先考虑: <head>    <title>Page Title</title>    <style type=&q ...

  5. [HTML/HTML5]7 使用列表

    7.1  在Web页面中使用有序.无序.定义列表 (1)有序列表 有序列表中的每一个列表项之前,都以一个数字或字母作为编号. <ol> <li>树莓</li> &l ...

  6. webservice 实现json模式

    直接上代码 public string GetUserInfoByOpenid(string openid) { var weixinuser = new WeiXinUser(); weixinus ...

  7. Android在代码中使用布局文件中的一个组件

    使用前必须要把组件与其父组件的关系断开,比如有一个组件的名称为scrollChildLayout,则可以使用下面的代码进行分离 ((ViewGroup)scrollChildLayout.getPar ...

  8. JavaScript 面向对象(一) —— 基础篇

    学好JS的面向对象,能很大程度上提高代码的重用率,像jQuery,easyui等,这篇博客主要从细节上一步步讲JS中如何有效地创建对象,也可以看到常见的创建对象的方式,最后也会附上一些JS面向对象的案 ...

  9. action和servlet的关系

      在struts2.0中,可以通过ServletActionContext.getRequest()获取request对象. 在action的方法中return一个字符串,该字符串对应struts. ...

  10. [原创]VM虚拟机Centos6.4网络配置。

    关于虚拟机VMware 3种网络模式(桥接.nat.Host-only)的工作原理http://www.cnblogs.com/hehexiaoxia/p/4042583.html 操作环境 主机:W ...