Ongeveer 549.000 resultaten
Koppelingen in nieuw tabblad openen
  1. To package a Java project into a JAR file, you can use either the command line or an IDE like Eclipse. Below is an example of creating a JAR file using the command line.

    Example: Using Command Line

    • Compile the Java files:

    javac -d ./build *.java
    Gekopieerd.
    • Create the JAR file:

    jar cvf MyProject.jar -C build
    Gekopieerd.
    • Run the JAR file (if executable): Ensure your MANIFEST.MF specifies the main class:

    Main-Class: com.example.MainClass
    Gekopieerd.

    Example: Using Eclipse

    1. Right-click on your project in Eclipse and select Export.

    2. Choose Java > Runnable JAR File and click Next.

    3. Select the main class under "Launch configuration."

    4. Specify the destination and name for your JAR file.

    5. Ensure "Extract required libraries into generated JAR" is selected, then click Finish.

    Considerations

    Feedback
  2. Guide to Creating and Running a Jar File in Java - Baeldung

    Usually, it’s convenient to bundle many Java class files into a single archive file. In this tutorial, we’re going to cover the ins and outs of working with jar – or Java ARchive – fi…
    Java Program Setup

    Before we can create a runnable jar file, our application needs to have a class with a main method. This class provides our entry point into the application:

    Jar Command

    Now that we’re all set up let’s compile our code and create our jar file. We can do this with javacfrom the command line: The javac command creates JarExample.class in the com/baeldung/jardirectory. We can now p…

    Using Maven

    4.1. Default Configuration
    We can also use Maven to create our jar. Since Maven favors convention over configuration, we can just run package to create our jar file. By default, our jar file will be added to the targetfolder in our project.

  3. How do I make a JAR from a .java file? - Stack …

    Get your other project and add this .jar file to project libraries. You can now …

    • Recensies: 5

      Codevoorbeeld

      <jar jarfile="${dist.jar}" update="true">
          <zipfileset src="${dist.jar}" includes="**/*.class" />
          <zipfileset src="${file.reference.iText-1.0.8.jar}" includes="**/*"/>
        <zipfileset src="${file.reference.itextpdf-3.2.1.jar}" includes="**/*"/>
      </jar>...
    • Mensen vragen ook naar
    • How to Create an Executable JAR with Maven?

      23 jul. 2025 · The JAR stands for Java ARchive. A JAR file is one of the package file format typically used to aggregate many Java class files and …

    • 3 Ways to Package Your Java Project into a JAR for …

      7 mei 2023 · In this tutorial, we will look at 3 ways to package your Java project into a JAR file, so you can ship your application to your users. A …

    • A Guide to Creating and Running Jar Files in Java - TecAdmin

      26 apr. 2025 · JAR files are a powerful feature of Java, facilitating the distribution and deployment of applications and libraries. By following the steps outlined in this guide, you’ll be well on your …

    • Java Deployment: Creation and Execution of Java …

      1 apr. 2025 · This tutorial will explain all about JAVA deployment. In a JAVA project, once coding is completed, you have to wrap all the files as a Java …

    • How to Create an Executable JAR with Maven

      20 okt. 2016 · In this quick tutorial, we’ll focus on packaging a Maven project into an executable Jar file. When creating a jar file, we usually want to run …

    • Create your first Java application | IntelliJ IDEA

      27 aug. 2025 · In this tutorial, you will learn how to create, run, and package a simple Java application that prints Hello World! to the system output. …

    • JAR files in Java - GeeksforGeeks

      26 jul. 2023 · A JAR (Java Archive) is a package file format typically used to aggregate many Java class files and associated metadata and resources …