1 Replies - 1523 Views - Last Post: 05 October 2009 - 04:51 PM Rate Topic: -----

#1 kzhuravl   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 21
  • Joined: 29-September 09

Read files from Server in JApplet

Post icon  Posted 05 October 2009 - 12:39 PM

I have some experience in working with Java Applets. I can make it(simple applet) running through web browser without problem. And I've come to the point where I need to put user's input into a file(on a server).

If I run it from terminal using make file it works. But if I put it on the server and try to run it like an applet through web browser it is not working.

My object(which I wanna save and load) is implementing Serializable, and I am saving it using ObjectOutputStream and FileOutputStream. I am loading it with ObjectInputStream and FileInputStream.

Here is some code from Main class:
// Some code
private final String FILE_PATH = "path";

public void init(){
				FileIO io = new FileIO();
		AccountManager a = new AccountManager();

		try {
			a = (AccountManager) io.loadObject(FILE_PATH);
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		} // end try - *
	   
				// Code continues
}

// Some more code



I have tried to putting a file path to the file, but it was not successful. Do I have to put URL there? If yes, can you give an example.
Can anyone give me a hint how should I save and load files if it is working through web browser on server?
I appreciate any help, thanks

Is This A Good Question/Topic? 0
  • +

Replies To: Read files from Server in JApplet

#2 pbl   User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8378
  • View blog
  • Posts: 31,956
  • Joined: 06-March 08

Re: Read files from Server in JApplet

Posted 05 October 2009 - 04:51 PM

Yes you will have to pass by an URL

http://www.webdevelo...read_write.html
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1