Running Ardor3D as Applet - java

I am trying to build a small applet that provides some 3d functionality into a website, and i have selected Ardor3D as it seems to tick the boxes. I have just started going with Java, and everything I have learnt so far has been from the examples files which has been enough to this point. The program is distributed by a JNLP file, that downloads the classes and defines how it starts, but I was wondering how to run it as an applet, so the 3d image output would be displayed in its rectangle at its position in a web browser window?
Thank You

Ardor3D has examples of running as an applet. Your game code will be the same as when running as a standalone app, but you extend an applet class instead. See for example the LwjglBoxApplet.

Related

Java Web Application AWT or Swing?

When developing a Java web-based application, is it necessary to use AWT?
I've been researching this question and the answers are confusing. Take for example, Runescape. The user visits the website and can play the game right there. They can also download a desktop application to play the game with.
If I am developing a game application, and my main window is created in a JFrame but all of my graphics are processed in a JPanel inside the main window, will I be able to implement this inside of a web page without much difficulty in the future? I want my game to be accessible simply by visiting the website and running the application.
Additionally, I've seen people reference "Java Web Start". Will this load the java application inside of the website, or does it install/run Java and execute the program (so if my main function opens a JFrame, it would appear on your taskbar). Perhaps I'm having some confusion between a Java application and a Java applet.
..will I be able to implement this inside of a web page without much difficulty in the future?
No. The security environment around applets was made much stronger in recent times, but even then, browsers tend to put further hurdles between applets and 'onscreen, loaded applets'. Chrome is set to remove the plug-in which would normally embed applets and a few other things.
I want my game to be accessible simply by visiting the website and running the application.
Additionally, I've seen people reference "Java Web Start". ..
Yes, offering a link to a JWS launched JFrame will be a lot easier, and a better experience for the end user.

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.

What is the best way to turn this Java Swing application into a sandboxed embed-able (applet or Web Start)?

I am working on a primitive online game client that I wrote as a Java Swing application. My problem is that potential users refuse to download and run any unfamiliar executable. I want my game to be reach as many people as possible and users fear that the executable might contain a virus. That is why I would like to embed the game client into my web page instead. How would you turn this Java executable code (liked below) into an applet?
Thus far I have a main which makes the initial connection to the game server...
https://dl.dropboxusercontent.com/u/214507961/Main.java
A Java Swing GUI that I made with the Netbeans GUI builder...
https://dl.dropboxusercontent.com/u/214507961/GUI.form
Object input/output streams connected to my game/web server...
https://dl.dropboxusercontent.com/u/214507961/Clients_Input.java
https://dl.dropboxusercontent.com/u/214507961/Clients_Output.java
And some buffered images for graphics...
https://dl.dropboxusercontent.com/u/214507961/Image_Repo.java
Note that in future development, I would like to replace much of the primitive looking 2D Swing GUI with content rendered with the Lightweight Java Game Library or some other higher-level video game graphics specific library to make the game look better.
Given that information, what is the best way to make this Java application into an embed-able (applet)? Describe your method and reasoning in such a way that even a college freshman could follow.
Note: Following the advice below, I have tried using WebStart, but I still get an intimidating warning:
Update:
I am in the process of refactoring my code so that the top level container is a JPanel.
I have tried making "GUI" extend JPanel and changing the "gamewindow" from a JFrame into a JPanel.
Modified Main:
https://dl.dropboxusercontent.com/u/214507961/Panel_Top_Level_Container/Main.java
Modified GUI:
https://dl.dropboxusercontent.com/u/214507961/Panel_Top_Level_Container/GUI.java
Despite the changes, Netbeans will not allow this program to run with Java Web Start.
When I enable WebStart and Build/Clean, Netbeans creates two files:
I then clicked Build/Clean and it generated two files:
master-application.jnlp
https://dl.dropboxusercontent.com/u/214507961/Panel_Top_Level_Container/master-application.jnlp
preview-application.html
https://dl.dropboxusercontent.com/u/214507961/Panel_Top_Level_Container/preview-application.html
but no JAR file.
Still working on it. AI moved the remainder of this question to:
Why can't I get Netbeans with Java Web Start enabled to work on my executable?
At this point I'm so tired of putting up with the security hassles and see little to no way to get around certification warnings without paying. I have decided that it would probably be better to just re-write the entire client in HTML5 and javascript.
The basic concept is to build your app (GUI basicly) without using applet specific technologies (like commmunication with web page via JS etc.) and with JPanel as a top level container insteed of of JFrame (Window would be accceptable too, as JApplet extends Window). If you do so, that you will be able to deploy the same code as standalone application and via JNLP as applet.
The digital signature could not be verified by a trusted source.
This is caused by the app. being 'self signed' by a digital certificate we generate ourselves using the SDK tools. Security was increased recently so that 'self signed' apps. get that scary warning. This has been discussed extensively across SO in recent times.
Try looking at the posts under applet+security for details.
Redo the client using HTML5 and Javascript so that you don't run into any prompts or security warnings.

Turning java application into applet

I followed a tutorial for a bit of learning java 2d gaming. It included turning it into an applet.
I use a class which is the launcher class, and it basically just launches it. It can be run as applet (using init) or an application (with main)
I expanded upon the code greatly, Adding a save and load feature using a flat .txt and .png files. which used get_property("user.home") and so forth.
Now I know that applet's on the browser can not save/view the persons computer information. So the above is useless for an applet.
What I have tried doing is commenting and adjusting everything that includes the persons computer information and so forth, And I still can not get the applet to load.
I am using dropbox to host it, I have tried different browsers and made sure the applet was not loaded into my cache for changes I did.
The applet in my eclipse IDE works fine-even saves, so I can't trust it, so I am using dropbox.
My applet did work, this was a long time ago before I developed the engine into my game.
I will share my GameHandler class because it holds the meat of the game. I really should organize this better. Any suggestions?
http://pastebin.com/zdmexGya GameHandler class.
I'm positive saveGame and loadGame do not even get called.

Run a Java game inside an SWF?

So, I wish to program a game in Java, but be able to post it on online video gaming websites. For some reason, most game websites do not support the use of .jar files, so I sadly cannot just publish that. However, I have seen one method that works, but I need an explanation to what it is, and how to do it. Some Java games appear to be put on an independent website, then an SWF loads the page, like a browser. For example, Runescape on Kongregate seems to run like this, despite the actual game being written in Java.
Is this a known method? Does anyone have any idea on how to do this? Please, I'd really like my game written in Java, not ActionScript. I can't imagine running Java from an SWF similar to how a browser does it is that hard. Thanks.
Runescape uses their own version of Java web start to play the game. When you first play Runescape, Jagex uses Java web start to load Java code to your computer that loads the rest of the game. That's what the update check does every time you play.
You can write your Java application so that it uses Java web start. You have to provide a URL on a web page so that the user's browser can download your code to their computer.
Your other choice is to write a Java applet. An applet is run from a web page. The web page has applet HTML to start the applet.

Categories

Resources