TOC
idea创建javaproject项目,引入jar包并打包
创建项目
引入jar包依赖
- 在根目录创建文件夹放置jar包,我放在了
lib
文件夹中
package Main;
import com.alibaba.fastjson.JSON;
public class TestMain {
public static void main(String[] args) {
System.out.println("12312321423");
User user=new User();
user.setAge(10);
user.setName("nihao");
System.out.println(JSON.toJSONString(user));
}
}
class User{
private String name;
private Integer age;
public User() { }
public String getName() {
return name;
}
public Integer getAge() {
return age;
}
public void setName(String name) {
this.name = name;
}
public void setAge(Integer age) {
this.age = age;
}
}
项目打包为jar包
- 构建build-build artifacts-build