[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Using Files Without Mounting A Share From Another System



On 2011-04-25, Hal Vaughan <hal@halblog.com> wrote:
--- SNIP ---
> A couple points here.  I checked the source code for the Dynamic Tree Demo that is used as a JNLP demo.  Now I will admit I haven't been using Java for a couple years and have some catching up to do (I think I was using Java 5, but know I've totally missed Java 6), but when I went over the source code for that demo, there was no main() method in the source.  Or, more correctly, there was, but it was commented out.  That, right there, is an indication that if you're writing an app in Java to be launched "normally," there will be different preparations than if you're using JNLP.  (I haven't used JNLP yet, but I did write some applets and even set up a couple Java apps to be both apps and applets.)
>

I can only think that the main() method was commented out later on. A
Java application deployed using JNLP has its entry point in the main
method, just like any other Java application. See the third bullet point
in the development tutorial[1].

> I even looked at their more in depth tutorial on deploying a JNLP project, but didn't find any way to launch one, other than through a browser.  (Which I don't want to do -- then I have to figure out the default browser from within a Java class on Windows, Linux, and OS X and launch it.)
>

You don't need to do that. You simply need the relevant file association
on the client. On a Debian system you have:

	$ grep jnlp /usr/share/applications/mimeinfo.cache 
	application/x-java-jnlp-file=sun-java6-javaws.desktop

When the .jnlp file is accessed over HTTP using a web browser, the
browser passes the file to the local javaws executable. Here the browser
is simply arranging the transport. Equally, the user could access the
.jnlp file using Windows Explorer or Nautilus, etc. You can even go
directly to the file from the command line:

	javaws http://download.oracle.com/docs/cd/E17746_01/tutorialJWS/deployment/webstart/ex6/webstart_ComponentArch_DynamicTreeDemo/dynamictree-webstart.jnlp

(There is an understandable but unfortunate tendency to confuse Java Web
Start with applet technology. An applet runs in isolation within a web
browser (at least we hope it does). In the case of JWS, once the
resources are delivered to the client then the browser or file manager
is out of the picture.)

>>> You need some sort of xml file defining the app to launch and while java  
>>> does not (want to) understand the smb:// protocol we are stuck.
>>> 
>>> I can indeed play JNLP based java applications that are hosted online but 
>>> I cannot run the java application I want to run while is on samba share. 
>>> At least not directly ;-(
>> 
>> Try using a UNC path in the JNLP descriptor, e.g.,
>> file:////server/share/app.jar. Windows clients will understand that.
>
> This works on Windows, with SMB, but that brings us back to the original point: Accessing a file on a network share without mounting the share.  On Windows, since SMB is built in, you can easily do that.  On Linux, you can't.  You can use smbclient and copy the file over to your system if it's on an SMB share, but nobody yet has provided a way to access a file on a network share from Linux without either mounting the share or copying the file over to the local computer first.
>

Yes, that is a problem.

> I'm looking at Java RMI, but that involves certificates and so on and I'm still not sure if I will easily be able to put that much on a client system that is trying to run the program.
>

And you would still have the problem of deploying Java software to each
client machine.

Are you in a position to put a web server on the machine which offers
the network share? That would allow you to serve up a .jnlp file and its
associated JAR file in a simple, standard and platform-neutral way.

I'll stop evangelising now :-)

[1]
http://download.oracle.com/javase/tutorial/deployment/webstart/developing.html
-- 
Liam O'Toole
Cork, Ireland


Reply to: