这种编译方法对吗?如何将它做成可执行文件呢?

xinhuagong 2003-04-17 12:14:33
import com.sensestream.app.myalbum.util.FormUploader;
import com.sensestream.media.MIMEType;
import java.io.*;

public class Submit3PIExample {

static String targetURL = "http://www.test.com/doSend.jsp";

static String senderID = "13910008585";
//static String recipientID = "13900000379";
static String recipientID;
static String subject = "3PI Test";
//static String targetType = "nokia7650";
static String targetType;
static String smilName = "mms.smil";
static String gifName = "Beach.gif";
static byte[] smil = null;
static byte[] gif = null;
public static void main(String args[]) {
String tmp;
recipientID=args[0];
tmp=args[1];
if(tmp=="1")
{
targetType= "nokia7650";
}
if(tmp=="2")
{
targetType= "ericssont68i";
}
if(tmp=="3")
{
targetType= "nokia6610";
}
if(tmp=="4")
{
targetType= "panasonicgd88";
}
smil = readfile(smilName);
gif = readfile(gifName);
doUpload();
}

public static void doUpload() {
try {
FormUploader uploader = new FormUploader();
uploader.addFormParameter("senderID", senderID);
uploader.addFormParameter("recipientID", recipientID);
uploader.addFormParameter("subject", subject);
uploader.addFormParameter("targetType", targetType);
uploader.addBinaryContent(smil, "application/smil", smilName, "filename");
uploader.addBinaryContent(gif, "image/gif", gifName, "filename");
uploader.upload(targetURL);
}
catch (Exception e) {
e.printStackTrace();
}
}

public static byte[] readfile(String filename) {

byte[] byteArray = null;

try {
FileInputStream f = null;

f = new FileInputStream(filename);
int len = f.available();
byteArray = new byte[len];
f.read(byteArray);
f.close();
}
catch (Exception e) {
e.printStackTrace();
}
return(byteArray);
}

}


javac -classpath MIMEupload.jar Submit3PIExample.java
java -classpath .;./MIMEupload.jar Submit3PIExample 13910337379 1


main(String args[])中的参数传递对吗?如果不对应该怎么传?
...全文
38 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
DavidBone 2003-04-23
  • 打赏
  • 举报
回复
ding
cloudtarget 2003-04-19
  • 打赏
  • 举报
回复
up
DavidBone 2003-04-18
  • 打赏
  • 举报
回复
up
seagullgao 2003-04-17
  • 打赏
  • 举报
回复
把MIMEupload.jar 加进你的ClassPath里面,然后
javac Submit3PIExample.java
java Submit3PIExample 13910337379 1
newman0708 2003-04-17
  • 打赏
  • 举报
回复
没有试过。
见高手了

62,614

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧