1 / 8

การโปรแกรมเชิงวัตถุด้วยภาษา JAVA

การโปรแกรมเชิงวัตถุด้วยภาษา JAVA. JAR (Java Archive). มหาวิทยาลัยเนชั่น http:// www. nation. ac.th. บุรินทร์ รุจจนพันธุ์ . ปรับปรุง 22 มิถุนายน 2550. JAR. jar (Java ARchive) ?

vance
Download Presentation

การโปรแกรมเชิงวัตถุด้วยภาษา JAVA

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. การโปรแกรมเชิงวัตถุด้วยภาษา JAVA JAR (Java Archive) มหาวิทยาลัยเนชั่น http://www.nation.ac.th บุรินทร์ รุจจนพันธุ์ . ปรับปรุง 22 มิถุนายน 2550

  2. JAR jar (Java ARchive) ? The JavaTM Archive (JAR) file format enables you to bundle multiple files into a single archive file. Typically a JAR file contains the class files and auxiliary resources associated with applets and applications. http://java.sun.com/docs/books/tutorial/deployment/jar/

  3. ประโยชน์ของแฟ้ม JAR ประโยชน์ของแฟ้ม JAR - มีความปลอดภัย (ไม่ถูกนำไปแก้ไข)- ลดเวลาดาวน์โหลดแฟ้ม - ลดขนาดแฟ้ม - รวมเป็นห่อเพื่อขยับขยายภายหลัง - กำหนดรุ่น และตีตราชัดเจน - พกพาสะดวก

  4. ตัวอย่างการใช้โปรแกรม JAR Short Sample DOS> javac x.java DOS> java x DOS> dir x.class DOS> edit manifest.mf DOS> jar cfm x.jar manifest.mf x.class DOS> java -jar x.jar

  5. Manifest คือ บัญชีแสดง ในแฟ้ม MANIFEST.MF กำหนดแฟ้มแรกที่ต้องประมวลผล Manifest-Version: 1.0 Main-Class: x

  6. ตัวอย่างการสร้าง x.jar 1. jar โปรแกรมในห้อง Bin 2. x.jar ชื่อแฟ้มที่ต้องการสร้าง 3. cfm ตัวเลือกสำหรับการสร้างแฟ้ม .jar 4. manifest.mf ชื่อแฟ้มที่กำหนดค่าเริ่มต้น 5. x.class รายชื่อแฟ้มที่ต้องการนำเข้า x.jar jar cfm x.jar manifest.mf x.class jar cfm x.jar manifest.mf x.class y.class z.class jar cfm x.jar manifest.mf v1/*.class

  7. การใช้งาน และจัดการ .jar 1. ดูแฟ้มใน .jar jar tf x.jar 3. ปรับปรุงหรือแทนที่แฟ้มเดิม jar uf x.jar x.class 2. แตกแฟ้ม .jar jar xf x.jar 4. ประมวลผล Application java -jar x.jar 5. ประมวลผล applet ในแฟ้ม x.htm <applet code=x.class archive=x.jar width=120 height=120> </applet>

  8. Checker Sample ส่วนหนึ่งของ checker01.java setBackground(new Color(192,192,192)); url = this.getClass().getResource("checker01w.gif"); imgw = Toolkit.getDefaultToolkit().getImage(url); url = this.getClass().getResource("checker01b.gif"); imgb = Toolkit.getDefaultToolkit().getImage(url); g.drawImage(imgw,i*w*2 + w,0,this); ทำซ้ำเพื่อสร้างตาราง for (int i=0;i<4;i++) for (int j=0;j<4;j++) { g.fillRect(i*w*2,j*w*2,w,w); g.fillRect(i*w*2 + w,j*w*2 + w,w,w); } ตัวอย่างการใช้คำสั่ง Applet ใน webpage <applet code=checker01.class archive=checker01.jar width=336 height=336> </applet> http://www.thaiall.com/class/checker01.zip

More Related