Matthew Pigram
Matthew Pigram

Reputation: 1430

Whats is the best way to interact with the server of a JWS java application

Im having some trouble determining how to write files using a Java Web Start program, I want to write files to the server describing files that have been uploaded to a cloud server. I also want to be sent data such as file names and paths from the client so that I can create a connection between the user and the cloud storage facility and send their files to it.

Currently when i try to run my Web Start Application it works fine and gives no errors, but simply will not write Files and Folders to the Server it resides on. For example, the following code does not work:

new File ("ArFile Clients\\File Data\\" 
        + user.getCompany().getName() + "\\" + user.getUsername()).mkdirs();

This directory is located on the server and it created to store data on users of the app. But during runtime it is simply ignored or not executed.

I am not using sockets or FTP or anything like that, the cloud server has its own custom library which I am using, I know for a fact that the issue must lie with how Java Web Start works, I just cant find any good examples involving creating files on the server machine and extracting data from a clients machine (just filesystem data like directories and files)

Upvotes: 1

Views: 278

Answers (1)

Mark Bramnik
Mark Bramnik

Reputation: 42461

I think some explanations of what webstart really is will be relevant here :)

First of all, web start is something that runs on the client JVM. Yes, it uses jnlp file where you should specify urls of the dependent jars/other resources. All that web start does is reads this jnlp file (again on client side), parses, figures out the list of urls where the resources exist and donwloads them onto the client machine. Physically this is achieved by using javaws utility that one can find in

%JDK_HOME%\bin folder. Just like ''java'' gets as an input a series of class-files/jars and spawns a jvm, javaws gets a jnlp, reads it, brings resources and spawns a jvm :) There is some additional stuff, the web start can do (like auto updates) but this is a 'core functionality'.

Bottom line, if you do want to write some files on server, web start is a wrong way to go.

Conceptually once your application gets loaded and you want to store files on server - create some kind of connection to the server machine from client and upload your files there. One way or another it can't be done with Web Start :)

I hope it helps

Upvotes: 3

Related Questions