当前位置: 首页 > news >正文

建设部投诉网站今日国内新闻摘抄十条

建设部投诉网站,今日国内新闻摘抄十条,win7局域网网站建设,家政门户网站源码工作中有时候偶尔写一些工具类、小程序,可是java程序员制作一个可运行jar实在折腾,利用idea开发环境,可以快速打包自己的可运行jar。具体怎么操作呢? 创建一个空白的java项目并完成自己的程序开发 完成java代码: /**…

工作中有时候偶尔写一些工具类、小程序,可是java程序员制作一个可运行jar实在折腾,利用idea开发环境,可以快速打包自己的可运行jar。具体怎么操作呢?

创建一个空白的java项目并完成自己的程序开发

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
完成java代码:

/*** 测试窗口* @author binbin* @date 2023/9/27 10:29*/
public class InfoFrame extends JFrame {public InfoFrame() {setTitle("System Information");setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);setSize(300, 200);//居中显示Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();setLocation((screenSize.width - getWidth())/2, (screenSize.height - getHeight())/2);//初始化菜单JMenuBar bar = new JMenuBar();JMenu menu = new JMenu("帮助");JMenuItem exitItem = new JMenuItem("退出");exitItem.addActionListener(e -> {System.exit(0);});menu.add(exitItem);bar.add(menu);setJMenuBar(bar);//初始化系统信息JTextArea infoTextArea = new JTextArea(6, 10);infoTextArea.setText(getSystemInfo());infoTextArea.setEditable(false);add(new JScrollPane(infoTextArea));}private String getSystemInfo() {StringBuffer b = new StringBuffer();b.append("系统系统:").append(System.getProperty("os.name")).append("\r\n");b.append("系统版本:").append(System.getProperty("os.version")).append("\r\n");b.append("系统架构:").append(System.getProperty("os.arch")).append("\r\n");b.append("用户名称:").append(System.getProperty("user.name")).append("\r\n");b.append("用户主目录:").append(System.getProperty("user.home")).append("\r\n");b.append("当前工作目录:").append(System.getProperty("user.dir")).append("\r\n");return b.toString();}
}
public class App
{public static void main( String[] args ){EventQueue.invokeLater(() -> {new InfoFrame().setVisible(true);});}
}

代码结构如下:
在这里插入图片描述

引入maven-assembly-plugin插件打包

<?xml version="1.0" encoding="UTF-8"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion><groupId>org.hbin</groupId><artifactId>info</artifactId><version>1.0-SNAPSHOT</version><name>info</name><url>www.binbin.org</url><properties><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding><maven.compiler.source>1.8</maven.compiler.source><maven.compiler.target>1.8</maven.compiler.target></properties><dependencies><dependency><groupId>junit</groupId><artifactId>junit</artifactId><version>4.11</version><scope>test</scope></dependency></dependencies><build><plugins><!-- 使用maven-assembly-plugin插件打包 --><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-assembly-plugin</artifactId><version>3.2.0</version><configuration><archive><manifest><!--主类 --><mainClass>org.hbin.App</mainClass></manifest></archive><descriptorRefs><!-- 可执行jar名称结尾--><descriptorRef>jar-with-dependencies</descriptorRef></descriptorRefs></configuration><executions><execution><id>make-assembly</id><phase>package</phase><goals><goal>single</goal></goals></execution></executions></plugin></plugins></build>
</project>

在这里插入图片描述

执行maven package

执行maven package命令,target目录将生成一个以jar-with-dependencies结尾的可直接执行jar。
运行命令:

> java -jar info-1.0-SNAPSHOT-jar-with-dependencies.jar

在这里插入图片描述

文档包和源码包

<!--生成doc jar包-->
<plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-javadoc-plugin</artifactId><executions><execution><id>attach-javadocs</id><goals><goal>jar</goal></goals><!-- 不让像@Param 这种后面没写值的东西 报错。--><configuration><additionalJOption>-Xdoclint:none</additionalJOption></configuration></execution></executions>
</plugin><!--生成源码jar包-->
<plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-source-plugin</artifactId><executions><execution><id>attach-sources</id><goals><goal>jar</goal></goals></execution></executions>
</plugin>

下次再有测试、运营或者其他部门的同事找你做工具,知道怎样快速制作可执行jar了吧?

http://www.hkea.cn/news/117184/

相关文章:

  • 摄影网课百度关键词优化查询
  • 打广告型的营销网站西安百度推广外包
  • 乌鲁木齐招聘网站建设一站式网络营销
  • 中小型网站建设服务淘宝数据分析工具
  • 梧州网站设计企业网站模板建站
  • 行政事业单位网站建设建议营销策划公司
  • 网络推广网站怎么做百度联盟广告点击一次收益
  • wordpress居中样式宁波seo网络推广外包报价
  • java做网站用到哪些技术网络营销的重要性与意义
  • 网络营销推广的作用谷歌seo什么意思
  • 免费网站建设解决方案郑州网络营销公司哪个好
  • 转转怎么做钓鱼网站税收大数据
  • 株洲专业网站排名优化深圳产品网络推广
  • 深圳美食教学网站制作如何免费搭建自己的网站
  • 兰州移动端网站建设广东整治互联网霸王条款
  • 彩票网站该怎么建设天津seo实战培训
  • 原平的旅游网站怎么做的新冠疫情最新情况最新消息
  • 网站开发软件著作权归谁seo外包
  • 小说网站的网编具体做哪些工作南宁网站快速排名提升
  • 承德网站设计seo互联网营销培训
  • 工信部网站备案查询 手机seo专员的工作内容
  • 淘宝活动策划网站视频营销成功的案例
  • 精准营销数据杭州排名优化软件
  • 中卫网站建站设计seo学习论坛
  • wordpress初始登录seo排名赚app靠谱吗
  • 软件外包保密协议seo相关岗位
  • 后台网站开发文档下载班级优化大师app
  • 辛集城乡建设管理局网站网络营销网络推广
  • 阿里云部署一个自己做的网站吗电商网站搭建
  • 免费汽车租赁网站模板网站域名解析ip查询