simpleshare.java

来自「这是一个用jsp+Oracle开发的联系人客户关系管理系统!」· 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 + -
显示快捷键?