源代码:
import java.security.*;
import javax.crypto.*;
import java.io.*;
public class StreamIn{
public static void main(String args[]) throws Exception
{
FileInputStream f=new FileInputStream("key1.dat");
ObjectInputStream ob=new ObjectInputStream(f);
Key k=(Key)ob.readObject();
Cipher cp=Cipher.getInstance("DESede");
cp.init(Cipher.DECRYPT_MODE,k);
FileInputStream in=new FileInputStream(args[0]);
CipherInputStream cin=new CipherInputStream(in,cp);
int b=0;
while((b=cin.read())!=-1)
{
System.out.print((byte)b+" ,");}
}
}
编译都成功,
运行报错,
C:\>java c:\StreamIn stream.txt
Exception in thread "main" java.lang.NoClassDefFoundError: c:\StreamIn
后来我把args[0]改成stream.txt但是什么也不显示
怎么回事
import java.security.*;
import javax.crypto.*;
import java.io.*;
public class StreamIn{
public static void main(String args[]) throws Exception
{
FileInputStream f=new FileInputStream("key1.dat");
ObjectInputStream ob=new ObjectInputStream(f);
Key k=(Key)ob.readObject();
Cipher cp=Cipher.getInstance("DESede");
cp.init(Cipher.DECRYPT_MODE,k);
FileInputStream in=new FileInputStream(args[0]);
CipherInputStream cin=new CipherInputStream(in,cp);
int b=0;
while((b=cin.read())!=-1)
{
System.out.print((byte)b+" ,");}
}
}
编译都成功,
运行报错,
C:\>java c:\StreamIn stream.txt
Exception in thread "main" java.lang.NoClassDefFoundError: c:\StreamIn
后来我把args[0]改成stream.txt但是什么也不显示
怎么回事
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货