vineri, 3 iulie 2015

Java: Packaging and Deployment

Simple compilation and run of a Test.java file: 

  • Separate source code from class files
>javac -d class *.java
  • Running the code
>cd class
>java Test

Making an executable JAR

  • Ensure that all files are located in class directory
  • Create a manifest.txt file
    • Set the main class --> add the line below in manifest.txt:
Main-Class: ImageProxyTest

  • Run jar tool to create a jar file
>jar -cvmf manifest.txt ImageProxyTest.jar *.class
  • Run the jar 
>java -jar ImageProxyTest.jar


Others:

  • With class in a package: \class>java test.patterns.virtualproxy.ImageProxyTest
  • Check the structure of jar file: \class>jar -tf ImageProxyTest.jar


Niciun comentariu:

Trimiteți un comentariu