如何打包java程序

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了如何打包java程序相关的知识,希望对你有一定的参考价值。

我讲手机QQ08版 在电脑上解压后替换了里面的声音文件,现在不晓得怎么还原成java的安装文件安装的手机上了,求教......

示例 1:将两个类文件归档到一个名为 classes.jar 的归档文件中:
jar cvf classes.jar Foo.class Bar.class
示例 2:使用现有的清单文件 "mymanifest" 并
将 foo/ 目录中的所有文件归档到 "classes.jar" 中:
jar cvfm classes.jar mymanifest -C foo/ .
参考技术A 你可以直接以Winrar打开那个Jar,把里面不要的图片删除,然后在同样位置放上你要替换的图片,关闭Winrar就还是能用的jar.为什么非要解压呢? 参考技术B 压缩为.zip格式,把.zip后缀改为.jar 参考技术C 压缩进压缩包后缀rar,然后修改成jar

JavaFx:如何配置使用jfx打包java程序

Eclipse如何配置通过jfx打包JavaFx为jar执行文件

1. maven打包配置

2. pom.xml中加入如下配置

<build>
  <plugins>
	<plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-compiler-plugin</artifactId>
           <version>3.3</version>
           <configuration>
               <source>1.8</source>
               <target>1.8</target>
           </configuration>
       </plugin>	  
    <plugin>
      <groupId>com.zenjava</groupId>
      <artifactId>javafx-maven-plugin</artifactId>
      <version>8.8.3</version>
      <configuration>
        <vendor>starwell</vendor>
        <mainClass>exhibitTerminal.Main</mainClass>
      </configuration>
    </plugin>
  </plugins>
</build>

3. 我的完整pom.xml配置

<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.xingwell</groupId>
  <artifactId>JavaCodeTool</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  
 	<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
 	</properties>
    <dependencies>
		<dependency>
		    <groupId>com.google.guava</groupId>
		    <artifactId>guava</artifactId>
		    <version>22.0</version>
		</dependency>    
		<dependency>
		    <groupId>com.github.oshi</groupId>
		    <artifactId>oshi-core</artifactId>
		    <version>5.6.1</version>
		</dependency>    
	  	<dependency>
	    	<groupId>mysql</groupId>
	    	<artifactId>mysql-connector-java</artifactId>
	    	<version>5.1.35</version>
		</dependency>
		<dependency>
		    <groupId>cn.hutool</groupId>
		    <artifactId>hutool-all</artifactId>
		    <version>5.7.15</version>
		</dependency>
		<dependency>
		    <groupId>org.projectlombok</groupId>
		    <artifactId>lombok</artifactId>
		    <version>1.18.4</version>
		</dependency>
		<dependency>
			<groupId>com.google.code.gson</groupId>
			<artifactId>gson</artifactId>
			<version>2.8.2</version>
		</dependency>
		<!-- javaFx -->
		<dependency>
	         <groupId>org.openjfx</groupId>
	         <artifactId>javafx-fxml</artifactId>
	         <version>11</version>
	     </dependency>
	     <dependency>
	         <groupId>org.openjfx</groupId>
	         <artifactId>javafx-controls</artifactId>
	         <version>11</version>
	     </dependency>
	     <dependency>
	         <groupId>org.openjfx</groupId>
	         <artifactId>javafx-graphics</artifactId>
	         <version>11</version>
	     </dependency>
	     <dependency>
	         <groupId>com.jfoenix</groupId>
	         <artifactId>jfoenix</artifactId>
	         <version>9.0.9</version>
	     </dependency>
	     <dependency>
	         <groupId>io.datafx</groupId>
	         <artifactId>datafx</artifactId>
	         <version>8.0.7</version>
	     </dependency>
	     <dependency>
	         <groupId>io.datafx</groupId>
	         <artifactId>flow</artifactId>
	         <version>8.0.7</version>
	     </dependency>
	     <dependency>
	         <groupId>org.kordamp.ikonli</groupId>
	         <artifactId>ikonli-javafx</artifactId>
	         <version>11.4.0</version>
	     </dependency>
	     <dependency>
	         <groupId>org.kordamp.ikonli</groupId>
	         <artifactId>ikonli-fontawesome5-pack</artifactId>
	         <version>11.4.0</version>
	     </dependency>
		 <dependency>
		 	<groupId>org.kordamp.bootstrapfx</groupId>
		 	<artifactId>bootstrapfx-core</artifactId>
		 	<version>0.2.4</version>
		 </dependency>
		 <dependency>
			<groupId>org.mybatis</groupId>
			<artifactId>mybatis</artifactId>
			<version>3.4.5</version>
		</dependency>
		<dependency>
			<groupId>mysql</groupId>
			<artifactId>mysql-connector-java</artifactId>
			<version>5.1.40</version>
		</dependency>
		<!--dbutils-->
        <dependency>
            <groupId>commons-dbutils</groupId>
            <artifactId>commons-dbutils</artifactId>
            <version>1.6</version>
        </dependency>
		<dependency>
		  <groupId>com.ibeetl</groupId>
		  <artifactId>beetl</artifactId>
		  <version>3.9.3.RELEASE</version>
		</dependency>
	</dependencies>
	<build>
	  <plugins>
		<plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.3</version>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
        </plugin>	  
	    <plugin>
	      <groupId>com.zenjava</groupId>
	      <artifactId>javafx-maven-plugin</artifactId>
	      <version>8.8.3</version>
	      <configuration>
	        <vendor>starwell</vendor>
	        <mainClass>exhibitTerminal.Main</mainClass>
	      </configuration>
	    </plugin>
	  </plugins>
	</build>
</project>

以上是关于如何打包java程序的主要内容,如果未能解决你的问题,请参考以下文章

如何打包java程序

如何将JAVA程序中使用的图片打包到JAR中直接使用

JAVA程序如何带上数据库文件一起打包啊???

如何将带包的java项目文件打包成jar

java打包求救

java如何打包