simpleshare.java
来自「“JSP数据库项目案例导航”一书从第一章到第十一章各章实例的源程序文件以及数据库」· Java 代码 · 共 37 行
JAVA
37 行
import java.io.*;
import net.jxta.pipe.*;
import net.jxta.share.*;
import net.jxta.share.client.*;
public class SimpleShare
{
private PeerGroup netPeerGroup = null;
private CMS cms = null;
public void startCMS()
{
try
{
netPeerGroup = PeerGroupFactory.newNetPeetGroup();
cms = new CMS();
cms.init(netPeerGroup,null,null);
String homedir = "SimpleShare";
if(cms.startApp(new Filehomedir))==-1)
{
System.out.println("CMS initialization failed");
System.exit(-1);
}
cms.getContentManager().share(new File("java.txt"));
}catch(Exception e)
{
System.out.println(e.getMessage());
System.exit(-1);
}
}
public static void main(String args[])
{
SimpleShare myShare = new SimpleShare();
myShare.startApp();
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?