On Apr 25, 2011, at 6:15 AM, Liam O'Toole wrote:

> On 2011-04-25, Hal Vaughan <h...@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].

OKay, I see that in link you provided.  It was in another class - I had looked 
at it several times but didn't see it.  (I always give a line break between 
methods in a class and anything else and they didn't, due to a learning 
disability with symbol recognition, so I missed it until I used grep.)

>> 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

Okay, that works for me.  One thing I said earlier was that I figure, at this 
point, I can count on Java being installed on the client's desktop computer.  
(I'll fill you in on that at the end of the email, since there's a few items 
I've mentioned already.)

I also just tested it on Windows (I only have up through XP and use it in a VM 
on my iMac) and javaws is in the path.  I don't know where the file 
associations are stored in Windows (probably in the registry), but in my case I 
think it's a relatively safe gamble that if Java is installed, javaws will be 
the default to handle a jnlp file.

> 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

I just tested that on Linux, OS X, and Windows.  It works on all three of them. 
 I had some trouble on Linux, since it's on a VM and doesn't have X and wasn't 
set to forward, but the fact that I got a Java error message tells me Java (or 
javaws) was attempting to run the program and did make it to the class file.

> (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.)

And that is a problem I was having.  I had never used JWS before and thought it 
was related to an applet.

>>>> 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.

There's more to the issue than that -- again, see below, so those that saw the 
first email don't have to read it all.

>> 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.

I can pretty much assume it's on the client's desktop.  I have some clients (as 
in human clients) who use Windows, a few that use OS X, and actually one or two 
that use Linux, so I have to make sure I'm dealing with all three OSes for this 
app.

> 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.

Yes, I can put apache on the server without a problem.  Considering it's an 
embedded system and only has 500 MB and 500 Mhz, I was hoping I wouldn't need 
it, but I can use it.

> I'll stop evangelising now :-)

No, don't stop.  You've actually solved my problem!

I know I can find this through experimentation and more research, but just in 
case you know off the top of your head, will the Java program being run through 
JNLP have a sandbox like an applet does?  (I know they're different, but will 
JNLP programs have a sandbox?)  And do you know if I can access $PATH (or the 
Windows equivalent) in the JNLP program so I could call another executable on 
that computer if I needed to?


Thanks!



Hal
------
Background, as promised:

This project is for an embedded system that will go on my clients' LANs.  Each 
client will have one Soekris net5501 system on their LAN.  I won't get into 
what it's doing, but they will interact with this system in two ways: 1) By 
running a setting editor that lets them modify settings in a MySQL database or 
heavily modify some tables in MySQL, and 2) By running Abiword on the net5501, 
with X forwarding so they can see what the document will look like when it's 
printed from this server.  (That way it'll be using all the fonts on the server 
and they won't have issues with using fonts on their desktop that aren't on the 
server and saving docs will not be a complex issue.)

I'm working with small business owners (mostly) and have found that every now 
and then I run into a wall of fear and ignorance.  Usually that happens because 
someone they know who "knows about computers" offered to fix things for them 
and made things worse.  (I've also had issues in the past because of 
incompetent "professionals.")  So I can't count on my embedded system (the 
server) having a static IP address and can't count on installing much on the 
client's desktop computer.  I've found I can count on Java, but I've had 
problems with Perl, since some people don't understand the concept of computer 
languages and how a language could be on their computer or that I'd need it to 
run my program even though no other program on their computer needs it.  (And 
yet some of these paranoid people have no problem with browsing unsafe porn 
sites that show up in their cache and downloading programs from questionable 
sources on the Internet because a web site looked like someone knew what they 
were doing.)

In my experience, though, I can count on Java.  It's installed on OS X, most 
Windows computers have had it added, and if not, in one case, when I had to 
download it, the fact that it came from Oracle was enough to convince the 
client it wasn't a virus.  And if it's one of the few clients I've had who have 
Linux as a desktop, they know about it anyway.

The catch is, since I can't count on a static IP address, I need something on 
the client's desktop, so I'm doing that by installing a single Java class from 
my website that, when run, will send out a broadcast on the LAN to find my 
server.  When it finds my server, it'll run the settings editor.

I didn't want to mount the shares from my server for several reasons.  One was 
due to paranoid clients like I described, one reason was because the IP address 
could change and I could run into problems with mounts on an old IP address, 
along with a few others.  But using JNLP will solve the issue of running the 
program without mounting the share, so that solves my big problem.

--
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/fe0c06bd-e1aa-4649-a64f-96b5a950d...@halblog.com

Reply via email to