This week's book giveaway is in the OCP forum. We're giving away four copies of OCP Oracle Certified Professional Java SE 11 Developer Practice Tests and have Scott Selikoff and Jeanne Boyarsky on-line! See this thread for details.
I ' m trying to run a swing application which is writing and reading data from MySql Database in
browser using JNLP file. Application is working fine if I run it on desktop , I mean its saving and
retrieveing data , but when I run the appplication in browser it is displaying the window with all the fields.
But all the data related code is not responding and also not showing any errors. Any clue ,what am I missing?
to initilaize the launch button i.e here the code for the html page,
var dir = location.href.substring(0, location.href.lastIndexOf('/')+1);
var url = dir + "dynamictree-webstart.jnlp";
when I click the button it starts the application and displays the window,but not diplaying
any data ,but working fine as a desktop appplication.
Ah, I see. So actually you are using the browser to download and install the application on the client system. So the installation is working correctly, and the application starts running on the client system? You will know if it does, because it will start up in a separate window and you can close the browser without causing the application to terminate. Can you confirm that?
Okay. Then you're just running it in the normal way. (Your reference to "running in the browser" confused me.) Anyway it's just an ordinary Java application, so you connect to the database in the normal way. If your code fails to connect to the database, do you have any way of finding out (a) that it failed to connect, and (b) the errors which caused it to fail? If you don't, then your first step should be to fix that problem.
I'm guessing that probably you just need to sign the application, but it's certainly possible that (for example) you hard-coded "localhost" as the location of the database server, and that worked OK in your testing because your test machine was the database server but now it doesn't work in the wild. Or there could be any number of other problems.
Mishaal Khan wrote:Yes I have hardcoded the server location as localhost and as you said its not able to find the server ,so what do mean
by sign the application ? Could it solve the problem ?
Well, it might, but first you have to fix the obvious stuff. The server location in your JDBC URL has to be the actual location of the database server. If it says "localhost" then that means "this computer" and therefore the application won't work on any computer except the database server computer. This might be the desired outcome but if it is, there isn't any point in distributing it via Web Start.
I got this tall by not having enough crisco in my diet as a kid. This ad looks like it had plenty of shortening: