Cannot open Jar file - java

I've started developing Java applications with NetBeans some days ago and I've created an applet that makes some stuff about linear equations and disequations. That applet is also stored on my server and I load it into a webpage using the <applet /> tag. When I double click the *.jar (generated from NetBeans when I load the project) file on my computer, nothing happens. I know this is a stupid question, I've also read a lot of articles about this question but I didn't solve my problem. What could I do if I want execute that jar file from my computer?

What could I do if I want execute that jar file from my computer?
The easiest way to achieve that is to launch the existing applet free floating using Java Web Start. JWS Can install desktop shortcuts or menu items to launch the app.
Re. suggestions that you have to make it a runnable Jar. That will work if the app. normally is a JFrame or Frame, but it won't work for an applet unless the applet has been written as an hybrid application/applet (and since you did not do that deliberately, no it wasn't).

Related

I have made a JFrame which I want to put in an HTML script. (I was going to use a JApplet but it has been deprecated)

I'm using IntelliJ IDEA, I have coded a frame which I want to put into an HTML file so I can run it in my browser, how do I do this now that I cannot use JApplet? I have found this documentation: http://docs.oracle.com/javase/tutorial/deployment/webstart/deploying.html and this http://docs.oracle.com/javase/tutorial/deployment/webstart/deploying.html but I am new to programming and find this difficult to follow. I don't know for instance how I would go about putting my class files and the image that I used in a separate directory nor do I know how I go about signing my application so that it will run in a browser.
I want to put into an HTML file so I can run it in my browser,
You can use the Desktop class. This class allows you to access default applications from your desktop.
Read the section from the Swing tutorial o How to Integrate With the Desktop class for more information and working examples.
See Java Plugin support deprecated and Moving to a Plugin-Free Web.
Note that is one of my 'copy/paste comments' that does not explicitly mention JFrame based apps., however the links are still relevant in that Oracle & browser makers would not be phasing out support for applets if they wanted programmers to keep trying to shove rich client apps (e.g. Swing GUIs) into thin client web pages.
OTOH you can offer a JFrame (or a JApplet) to be launched from a link in a web page to end up free floating on the desktop of the user by using Java Web Start.
Even then, it is not a simple matter for the programmer or the end user. The programmer needs to ensure the app is digitally signed using a code signing certificate issued by a CA (usually they are expensive). The end user used to just be able to click the link, 'OK' the prompts produced by the Java virtual machine, and see the app appear on-screen. But now most browsers will download the launch file to the local file system rather than directly hand it to the JVM to be launched. So the user faces an extra step in explicitly finding the downloaded launch file and double clicking it.
This is all due to security concerns related to bugs in the plug-ins that run things in web pages. So if you were to find a way around all these hoops, please let us know. It is a security bug that requires urgent fixing.

Load Linux library through a Windows client

several years I used to come on the bible of coding and I have (maybe) a question rarely asked. First of all thanks to all people which takes time to answer us.
I have a network with a Linux server and some Windows clients. On the server I have to use a Java application (I don't have source code) but it's hard to use it on the server : graphic card drivers are not update then the resolution of the screen is "small" and not expandable. It's a problem because layouts of the app are not dynamics then some important buttons are not displayed (is it so hard to use a JScrollPane ???). And I don't really want to learn how many times I have to use Tab for each hidden button.
Then one solution is to launch the app on a Windows client through MobaXterm. It works well but at one moment a process need a library.
I tried to launch the app by adding the library path of the library, a *.so file, but didn't work.
The question is : a java application installed on Linux and launched through a windows client need *.so or *.dll library ?
Thanks.
Florent

Publishing a .jar game online

I have created a simple java game and received a .jar file. I want to publish this game online on game websites (flash game websites such as kongregate, miniclip, etc.) but am unaware as how i would go about doing this. I have read that you create an applet to post the game online; but can I do that for a website that i am unable to edit?
TLDR: How to post .jar file on website, & if you do so via applet, can someone who cannot edit the site create an applet for the website?
If it is the latter can someone guide me towards a guide for creating an applet?
How to post .jar file on website, & if you do so via applet, can someone who cannot edit the site create an applet for the website?
Short answer, no. Long answer, nope.
In fact, it surprises me that you would think that you can launch an applet from a site when you cannot edit it! If that were possible, I could insert spam ads in a site that is supposedly under your control!
As to deploying the application:
The best way to deploy a Java desktop application is using Java Web Start. A JWS app. can be launched from a link on a web site.
It is a lot easier to deploy a JWS app. than it is to deploy applets (which, BTW, soon won't be supported in Chrome or IE at all, and are by default blocked in Safari and FF).
You will still need 'edit permission' on the site to launch a JWS app. As well as the ability to add new files to the site (e.g. the Jars(s) & the JNLP file used to launch the app.).
Lastly, either applets or JWS will need to be digitally signed by a valid certificate before there is a good chance of the JRE allowing them to launch.
I have created a simple java..
Not looking so simple now, is it? ;)
Deployment is typically a lot harder than people expect, and in the case of 'simple apps.' harder than they were to code and debug..

Made a .jar file of an app I made using JFrame in java. Which works 100%. But when I have it loading from a website, its just a blank white screen

So as I tried to describe in the title.
I made an application that works 100% when compiled, and also when opened with the .jar file I made for it.
So my next step was to run this from my online portfolio. However, when I use the
<APPLET ARCHIVE="xxxxx.jar" CODE="xxxxx.class" WIDTH=400 HEIGHT=300>
</APPLET>
approach... So the Applet prompts me to run, I click Yes. My JFrame pops up like it normally would, however it is just a completely white blank screen. ( no content from my app )
I must have them linked appropriately if the JFrame even loads at all. So I'm not sure whats up.
Any help? Thanks
Edit: I forgot to mention, I am running this locally at the moment. Not sure if they would have anything to do with anything.
What method would I use to upload a .jar file to be executed from a web page?
For deploying Java desktop apps., the best option is usually to install the app. using Java Web Start. JWS works on Windows, OS X & *nix.

Demo Java application runnable from a DVD

I wish to give some demo copies of a Java application on a DVD to a client. Does it make sense to have a preinstalled JRE and Java application on a DVD so that they can just click and run it?
Also, if anyone has done this what are your views on this?
I would suggest you skip the DVD and go for a flash drive instead. This way you can use portable Java and run your app from the flash drive without having to install anything on your client's computer. With the low costs of flash drives these days you should easily earn back what you spend in money in convenience and time.
Here is a tutorial that shows you how to set this up.
Indeed you can simply put a JRE into a directory of the DVD.
Then you start the application with a .bat file that runs a command such as :
jre\bin\java.exe -jar Main.jar
(If your jar and the jre folder are in the same directory)
Be careful about one thing : you can't know in advance what the DVD's drive letter will be, so in your .bat file you must give relative paths to the JRE and to your jar (or starting class).
If you are dealing with a one or two people then just throw a JRE on the DVD and explain how to install it or even just include a link to the page where they can install Java themselves. In the past when dealing with a large set of recipients that needed to install a JRE and run an application, I have used tools like InstallAnywhere, to create a simple setup to walk the user through a wizard for setup.
I've in the past copied a windows JRE directory to a USB flash drive, and run a java app off that.
If:
The users have an internet connection
The demos. have a GUI
You can deliver them off a site
..I would recommend using deployJava.js to ensure a suitable minimum JRE, & Java Web Start to download/install & launch the demos.
JWS has a number of advantages in this situation:
Server hits for the resources will reveal what proportion of the people to whom the demo. was delivered, are actually trying it.
JWS offers 'lazy downloads' so that if a potential user is only interested in one small section of a large application, they do not have to download the entire binary.
If the user turns a demo. into a registered version, (at least parts of) the app. will be already installed.
But in the event that it is a constantly changing app., JWS will automatically update any new parts of the app.
All this is part of the 'one click' installation experience for JWS. It is more tricky for a developer to set up, but once done well, is a breeze for the end-user.
You might include an HTML page on the CD (DVD would be a waste for a single HTML, a couple of images & some CSS based style sheets) that links to the demos. But since the hardest thing about getting a user to try a demo. is getting them to put the disk in the drive, I would side-step the disk entirely & send the 'Here are some free demos.' HTML to the user as email.
This was included as a comment a couple of days ago. Since the thread was resurrected, I decided to include it as an answer & expand on it.

Categories

Resources