[jcifs] Help...need to confirm that I am on the right track

Laura McCord mccordl at southwestern.edu
Wed Apr 18 15:44:04 GMT 2007


I have the following code and I am trying to load a jpeg image from a
remote windows share and
display it. I don't know if I am on the right track.

Any idea/suggestions would be greatly appreciated.

Thanks.


public class PhotoRetrieval {
	private static BufferedImage myImage;
	
	public static void main(String[] args){
		System.out.println("testing");
		Config.setProperty("jcifs.netbios.wins", "host_ip");
		Config.setProperty("jcifs.smb.client.domain", "domain");
		Config.setProperty("jcifs.smb.client.username", "user");
		Config.setProperty("jcifs.smb.client.password", "pwd");
		System.out.println("testing");
		try{
			SmbFileInputStream in = new SmbFileInputStream("smb://host_ip/idworks/Image002/20060725/273251.jpg");
			 JPEGImageDecoder decoder = JPEGCodec.createJPEGDecoder( in );
			 myImage = decoder.decodeAsBufferedImage();			
			 in.close();
		}catch(Exception e){
			e.printStackTrace();
		}
	
	}
	 public void paint(Graphics g) {
	        // Draw image
	        g.drawImage(myImage, 0, 0, null);
	 }
}


More information about the jcifs mailing list