Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1071627
  • 博文数量: 252
  • 博客积分: 4561
  • 博客等级: 上校
  • 技术积分: 2833
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-15 08:23
文章分类

全部博文(252)

文章存档

2015年(2)

2014年(1)

2013年(1)

2012年(16)

2011年(42)

2010年(67)

2009年(87)

2008年(36)

分类:

2009-07-09 14:40:04

jar create and use method
1. working directory /root/temp/java

2. vi /root/temp/java/Test.java content

        public class Test
        {
                public void output()
                {
                        System.out.println("this is jar test!!!");
                }
        }

3. cd /root/temp/java
   javac Test.java
   jar cf lib.jar Test.class

4. vi /root/temp/java/main.java content
        public class main
        {
                public void main(String args[])
                {
                        Test t = new Test();
                        t.output();
                }
        }

5. export CLASSPATH=$CLASSPATH:/root/temp/java/lib.jar
6. javac main.java
7. java main --> output "this is jar test!!!"
8. over

阅读(620) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~