aspose file tools*
The moose likes JNLP and Web Start and the fly likes JWS: Executable jar runs but doesn't show the data Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JNLP and Web Start
Bookmark "JWS: Executable jar runs but doesn Watch "JWS: Executable jar runs but doesn New topic
Author

JWS: Executable jar runs but doesn't show the data

Roshni Singhania
Ranch Hand

Joined: Mar 11, 2007
Posts: 78
Hi, I'm trying Java Web Start for the first time today. I installed Apache Web Server and tested it using "localhost" in my browser and it's running fine. I've written a jnlp file and an html page, which has a link to my executable jar file. The pages loads, shows the link, I download the jar to my desktop, but when I execute it, it just shows the GUI, not the data that it's supposed to read from a text file accompanying it. But that same jar files runs fine, shows the data also, when I directly run it from my computer (NOT through the web server).

I'm just not able to understand why the data is not being displayed in my GUI when I download this jar from the web server and it's displayed fine when I run it locally. I've copied that same local file to Apache's documentroot. There's not error or anything. It just doesn't show the data.

Can anyone tell me what I'm doing wrong when I try to run it through JWS? Do I need to post the files that I'm trying to deploy in JWS here? Please provide some pointers, I'm quite clueless as to what's missing.
Ray Johnson
Greenhorn

Joined: Dec 14, 2007
Posts: 13
if you can post some information on the folder structure where you are placing you text file with data and java code inside jar from which you are trying to read the data, it may help to find the problem more precisely.


"It's been so long since I've done a good thing--the right thing" : Tears Of Sun
Roshni Singhania
Ranch Hand

Joined: Mar 11, 2007
Posts: 78
Thank you so much for replying! I've been trying, but I still get the same problem and I didn't know where to look for help.

Ok, I've a folder on C drive (it's not where OS is installed, though), called "MyQuiz". And I've placed MyQuiz App Homepage.html, MyQuiz.jnlp, a jpg file called ic.jpg and the MyQuiz.jar file.

Here's the code in the application file -



Below is the html file code -



And here's the jnlp file code -



I'm sorry this is long, but I'm new to the whole JWS stuff. So I've tried to give all the details, hope this helps to figure out the problem. I just need some pointer as to what I'm doing wrong. Same jar file runs on my desktop, but it won't run through the "server's" folder. The program launches but doesn't show the data. I don't understand why! What am I missing out here?
William Wallace
Greenhorn

Joined: May 08, 2008
Posts: 2
JWS will install jar and expland it on C:/doc and settings/<useridofmachine>/applicationdata/sun/java/jws/cache directory..please check proper path, and your properties file should be present on root of your jar file under above folder then only it will work.
Let me know...
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

"sir william wallace",
Welcome to the JavaRanch.

We're a friendly group, but we do require members to have valid display names.

Display names must be two words: your first name, a space, then your last name. Fictitious names are not allowed.

Please edit your profile and correct your display name since accounts with invalid display names get deleted.
William Wallace
Greenhorn

Joined: May 08, 2008
Posts: 2
Done...and thanks for reminding.
Roshni Singhania
Ranch Hand

Joined: Mar 11, 2007
Posts: 78
Hi William Wallace,

Thanks for replying. I checked the path to the cache directory as specified above, but that folder is empty. And I didn't really get the next line - "and your properties file should be present on root of your jar file under above folder then only it will work." I'm sorry, but I didn't understand. Which properties file? Can you please explain again? I'm totally new to JWS.

Edit: And also, the path in my computer is as follows -

D:\Documents and Settings\MyHome\Application Data\Sun\Java\Deployment\cache

There's no jws folder in the java directory, as you've specified above. And the other folder in the sun directory is jre1.6.
[ May 16, 2008: Message edited by: Roshni Singhania ]
karthikeyan Chockalingam
Ranch Hand

Joined: Sep 06, 2003
Posts: 259
Can you please try placing these lines below in the JNLP file ?



http://www.skillassert.com


Roshni Singhania
Ranch Hand

Joined: Mar 11, 2007
Posts: 78
Hi,

Thanks for replying. I added that line after </resources> and tried again. When I downloaded the jar file from the HTML page & tried to run it, it didn't run and gave following exception, after which I removed that line and tried downloading and running it again, but it gave the same exception again. Then I added that line again, but same thing! I don't understand - it used at least show the GUI of the program minus the data, now it won't even show the GUI. The wrapped exception says "FileNotFoundException" for the jnlp file, but I can't figure out why!

P.S. When I type localhost in my browser, it shows all the files in the "web directory" (I suppose that's what it's called?), including jnlp file.

Exception -

com.sun.deploy.net.FailedDownloadException: Unable to load resource: http://localhost/MyJWS/MyKviz.jnlp
at com.sun.deploy.net.DownloadEngine.actionDownload(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getCacheEntry(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getResourceCacheEntry(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getResourceCacheEntry(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getResource(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getResource(Unknown Source)
at com.sun.javaws.LaunchDownload.getUpdatedLaunchDesc(Unknown Source)
at com.sun.javaws.Launcher.downloadJNLPFile(Unknown Source)
at com.sun.javaws.Launcher.prepareLaunchFile(Unknown Source)
at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source)
at com.sun.javaws.Launcher.launch(Unknown Source)
at com.sun.javaws.Main.launchApp(Unknown Source)
at com.sun.javaws.Main.continueInSecureThread(Unknown Source)
at com.sun.javaws.Main$1.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)


Wrapped Exception -

java.io.FileNotFoundException: http://localhost/MyJWS/MyKviz.jnlp
at sun.reflect.GeneratedConstructorAccessor2.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection$6.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.net.www.protocol.http.HttpURLConnection.getChainedException(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at com.sun.deploy.net.BasicHttpRequest.doRequest(Unknown Source)
at com.sun.deploy.net.BasicHttpRequest.doRequest(Unknown Source)
at com.sun.deploy.net.BasicHttpRequest.doGetRequest(Unknown Source)
at com.sun.deploy.net.DownloadEngine.actionDownload(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getCacheEntry(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getResourceCacheEntry(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getResourceCacheEntry(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getResource(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getResource(Unknown Source)
at com.sun.javaws.LaunchDownload.getUpdatedLaunchDesc(Unknown Source)
at com.sun.javaws.Launcher.downloadJNLPFile(Unknown Source)
at com.sun.javaws.Launcher.prepareLaunchFile(Unknown Source)
at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source)
at com.sun.javaws.Launcher.launch(Unknown Source)
at com.sun.javaws.Main.launchApp(Unknown Source)
at com.sun.javaws.Main.continueInSecureThread(Unknown Source)
at com.sun.javaws.Main$1.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.io.FileNotFoundException: http://localhost/MyJWS/MyKviz.jnlp
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at java.net.HttpURLConnection.getResponseCode(Unknown Source)
... 18 more
James Grossling
Greenhorn

Joined: May 20, 2008
Posts: 6
With

the vm will search in the temporary folder where the jar is located after downloading from server. You have to use ClassLoader to get the resource out of the jar, if it's packed in the jar. If it's somewhere on your webserver, then you should point to the right location on your webserver.

Maybe your webstart jar does not get the permissions to read on your computer. You can add the all-permissions thing, (it could be that you need to sign the jar then, i can't recall at the moment as I don't have an example with me at the moment, and it has been a while since I used webstart)


Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

"redlab",
Please check your private messages.
-Ben


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Roshni Singhania
Ranch Hand

Joined: Mar 11, 2007
Posts: 78
Ok, so I just put that file which provides the data to the program in the same folder, rather than packing it up with the jar file. So that solved one problem. Although I'll need to do some research about using ClassLoader class too.

But while downloading and launching that application through jnlp file, I still get the same exceptions. I can see the jnlp file in that folder, but the JWS still gives me FileNotFoundException. I don't understand why! I Checked all the files/names everything for any uppercase/lowercase mistakes, but everything seemed fine to me. What other reason could be there that JWS is giving FineNotFoundException?
Roshni Singhania
Ranch Hand

Joined: Mar 11, 2007
Posts: 78
Hi,

Can anyone please help me with this FileNotFoundException? The file it cannot find is right there and I can see it when I type "localhost" in my web browser. So why can't JWS find this file? Any help is appreciated. Thanks in advance.
James Grossling
Greenhorn

Joined: May 20, 2008
Posts: 6
You mean the jnlp file can't be found? You can't even start your app? Maybe something is wrong in the jar structure or jnlp descriptor. Write it again/make a new one from scratch.

check out Webstart Developers Guide if you didn't read it yet, it should explain everything you need more then enough.
Roshni Singhania
Ranch Hand

Joined: Mar 11, 2007
Posts: 78
Hi,

Thank you very much for guiding me to the docs.

Ok, I rechecked the paths and did all the jar-signing stuff and now it's finally working. Thanks again!

I also read about the updates done by the JWS if the application is updated on the server. I have another question related to same thing - if we don't specify - "oflline-allowed" tag, then JWS can update the application whenever there's new update available, right? So if my jar application is using data from a text file packaged with it and if I update that text file and re-package it in the jar and put this jar file on the server, then client application is updated automatically when I insert an updated text file, am I correct here? If yes, then will JWS download whole jar file all over again or just update the text file inside the jar file? How exactly does that work?
srilatha nimmaneni
Greenhorn

Joined: Jun 22, 2009
Posts: 15
Roshni Singhania wrote:Hi,

Thank you very much for guiding me to the docs.

Ok, I rechecked the paths and did all the jar-signing stuff and now it's finally working. Thanks again!

I also read about the updates done by the JWS if the application is updated on the server. I have another question related to same thing - if we don't specify - "oflline-allowed" tag, then JWS can update the application whenever there's new update available, right? So if my jar application is using data from a text file packaged with it and if I update that text file and re-package it in the jar and put this jar file on the server, then client application is updated automatically when I insert an updated text file, am I correct here? If yes, then will JWS download whole jar file all over again or just update the text file inside the jar file? How exactly does that work?



Hi

After developing code in our server machine, how to run in client side, in client side we have to paste any jar 's how to run it in client location,
we have to deploy the folder into the root machine in the client location. or just we will give link to user..

can tell me the process please.
i am not able to do this
my requitement is if take any exe file in the server ( editplus) from the client side after opening the server system, after clicking exe it should be installed in the client locatin
how to achieve this please tell me any body please using JNLP
srilatha nimmaneni
Greenhorn

Joined: Jun 22, 2009
Posts: 15
I am following the above example i am also getting the same error and i was checked all the jarsign's and i did 2,3 time from the scratch. and also

can any body tell me after running this application i have to write for client supparate or one is enough, i think one is enough right
can any body tell me after running this code in server side ( example my machine), client side what is the process i have to please
any body tell to me i am new to JNLP.


Roshni Singhania
Ranch Hand

Joined: Mar 11, 2007
Posts: 78
Hi,

I'm the same person who'd started this topic last year. I have encountered another problem in JWS.. Actually I'm again getting back to JWS after a long time, so I was trying to run my old (above mentioned app again). This time the problem is that, when I try to launch the application through the HTML file by clicking on the link through "localhost" using Apache Web Server, it doesn't work.. it shows me the code in the jnlp file. But same thing works locally i.e. no web server involved.. just this html file in a random folder and it launches the Jar (shows a dialog box asking whether to open or save the jar file). I've done this before and as mentioned in the first post in this topic, it was launching through "localhost", only it was not showing the data. Now it's not even launching.. it showing me the jnlp file's xml code when I click on the link. Anyone can help as to what's going wrong here? I'd really appreciate some hints!

Thanks in advance.
Roshni Singhania
Ranch Hand

Joined: Mar 11, 2007
Posts: 78
Hi,

I figured out what was missing. I'd not added the below line in mime.types file in Apache Web Server's conf folder -

application/x-java-jnlp-file jnlp

JNLP file was not being recognized without above. Adding it solved the problem.

srilatha nimmaneni
Greenhorn

Joined: Jun 22, 2009
Posts: 15
Roshni Singhania wrote:Hi,

I figured out what was missing. I'd not added the below line in mime.types file in Apache Web Server's conf folder -

application/x-java-jnlp-file jnlp

JNLP file was not being recognized without above. Adding it solved the problem.




when i am running the above example I am getting this exception Unable to lunch and if i click the details i saw this exception.

Error: unexpected exception:java.lang.reflect.InvocationTargetException


java.lang.reflect.InvocationTargetException

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.sun.javaws.Launcher.executeApplication(Unknown Source)
at com.sun.javaws.Launcher.executeMainClass(Unknown Source)
at com.sun.javaws.Launcher.doLaunchApp(Unknown Source)
at com.sun.javaws.Launcher.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NoClassDefFoundError: FlashTest$ShowAnsListener
at FlashTest.buildGUI(FlashTest.java:51)
at FlashTest.main(FlashTest.java:139)
... 9 more
Caused by: java.lang.ClassNotFoundException: FlashTest$ShowAnsListener
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at com.sun.jnlp.JNLPClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
... 11 more


Can any body tell me how to resolve this issue.

I am running the applln in my machine , how to run the same appln in server client ( we will think as my machine as the server machine).
ramy hassan
Greenhorn

Joined: Sep 14, 2009
Posts: 3
Hello,

Roshni Singhania wrote:Hi, I'm trying Java Web Start for the first time today. I installed Apache Web Server and tested it using "localhost" in my browser and it's running fine. I've written a jnlp file and an html page, which has a link to my executable jar file. The pages loads, shows the link, I download the jar to my desktop, but when I execute it, it just shows the GUI, not the data that it's supposed to read from a text file accompanying it. But that same jar files runs fine, shows the data also, when I directly run it from my computer (NOT through the web server).

.


i got the same problem and i don't know what's the reason please if any one can help me
 
wood burning stoves
 
subject: JWS: Executable jar runs but doesn't show the data