Trouble with an old java applet - java

We're using this website to teach modern physics at our university. I've noticed that modules 10.1.1 and 10.1.2 work on some computers but not others (on some the animations wont appear, but you still get a grid and timer). These computers have the same hardware and set up as far as I can tell. Also on certain computers 10.1.1 will run, but 10.1.2 will not. I am at a loss. The trouble occurs only with these applets and not with other java modules on the website. Have any idea what it could be and if there could be a fix?

Related

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.

PlayN java desktop version slower than web version?

so i've been playing with google PlayN, and i built a small sprite sheet loader for explosions.
what is weird thought is that the desktop java version (that uses the same core code) runs way slower than my web version.
for instance my web version: sapropwns.appspot.com (click with left mouse button and drag the pointer), as you can see its pretty smooth. on the other hand the java desktop version lags every like 2 secs and doesnt draw as much as this web version (the trail doesnt have as much drawing even though both use the same mouse callback for drawing at the same speed).
is there a limitation on the PlayN library that im missing?
thanks in advance.
It's been a while since I looked at PlayN (I was poking at it for a little while for fun). But performance for desktop apps may not be great for certain applications since they are using straight-up Java2D for their rendering. I'm also guessing it's not all that optimized at this point.
There is some discussion on the PlayN group about improving performance by switching from Java2D to LWJGL (Lightweight Java Game Library). This would improve performance greatly for desktop apps (Minecraft uses LWJGL).

Is it possible to run Java3D applications on Nvidia 3D Vision hardware in windowed mode?

Thanks to JohnnyO it was already answered if it is possible to run Java3D application in conjunction with nVidia 3D vision:
Is it possible to run Java3D applications on Nvidia 3D Vision hardware?
His approach also worked fine for me. But it is restricted to full screen mode.
His thread is already a few months old, and now during the last few weeks nVidia improved its drivers for 3D Vision: Now it is possible to run many applications also in windowed mode. If you are using professional hardware like the nVidia Quadro cards or ATI Fire GL, you know and appreciate the windowed mode already for a very long time.
Now, with the latest updates of the nVidia drivers (I have currently installed 295.73) it is also possible to run many applications like the nVidia Picture Viewer, the Stereoscopic Player etc. in windowed mode.
http://nvidia.custhelp.com/app/answers/detail/a_id/2311
Normally DirectX 9 applications should run in windowed mode, as you can read on the previously mentioned nVidia page. And I think Java 3D is a DirectX 9 application. If I use:
-Dj3d.debug=true
Then the console says:
[j3d] Using DirectX D3D 9.0 or higher.
(And of course no one seems to be working on the improvement of the DirectX implementation of Java 3D these says.)
Did somebody meanwhile find out the trick how to run Java3D in Stereo windowed mode? I tried it, but I failed so long. I think this will be a very important argument pro Java 3D, if we solve this issue!
One thing I noticed when I played around with this was that the 3D vision drivers weren't kicking in, even when I thought I had everything set up correctly.
One hack we found was that the nVidia drivers were actually only configured to support specific video games on their whitelist, but the whitelist matching was just based on exe names.
After lots of problems and frustration, we renamed our Java wrapper from myprogram.exe to something from the whitelist, things worked much better. I think for a while, or exe was named BatmanAC.exe in testing or something like that. This seemed to make the nVidia drivers much more permissive to what we wanted to do.

Droid programming with Eclipse in Java

I have a Neatbeans application, that works well and runs well so I want to move it into Android. So I am taking code snippets and moving it into Eclipse, and into a default made droid class. (which compiles, loads, and displays on the virtual device)
The problem, is that a few things that used to "import" into Netbeans, won't in Eclipse, or I am just doing it wrong, not sure.
Usually in Neatbeans I hit "import such and such class" and then it all compiles fine and no red errors appear in the code. In Eclipse, it is not giving any import option to some features, examples are..
DefaultModelList
HTMLUnitDriver/WebDriver (Selenium's program)
JOptionPane
And I am guessing some more will eventually pop up in the future.
Does Eclipse not support those options or something? Or is it Android that does not support those options?
Can someone tell me how to work around those issues, with their respective problems please?
The program itself is a mobile chat application, that will basically be a mobile version, of a chat that already exists on the web. Pulls chat feed data, lets you post chats back; basically the same thing as the chat on the website, but accessible from your smartphone.
Your problem is not with NetBeans vs. Eclipse. It sounds like your app uses the Java UI Framework Swing, from which you have JOptionPane. Swing is not available under Android, and anything that uses Swing will have to be extensively recoded to use the native Android UI instead.
Your app may use other libraries that aren't available in Android, as well.
Eclipse does support those options (press ctrl-shift-o). The problem is most likely the transition to Android -- lots of items change names. The Android native item to use is not JSpinner but Spinner, etc.
Also: In Android most GUI work is done with layout .xml files, a bit different than plain Java programming.
TLDR: you're conflating multiple issues. Eclipse can even import a Netbeans Project directly.
Is Eclipse a strong requirement for you? If you love NetBeans and everything is working, why not to continue with it? I believe you can develop for Android in NetBeans too...
http://binarywasteland.com/2011/07/install-netbeans-android-sdk/

Java Robot key activity seems to stop working while certain software is running

I'm writing a Java application to automate character actions in an online game overnight (specifically, it catches fish in Final Fantasy XI). The app makes heavy use of java's Robot class both for emulating user keyboard input and for detecting color changes on certain parts of the screen. It also uses multithreading and a swing GUI.
The application seems to work perfectly when I test it without the game running, just using screenshots to trigger the apps responses into notepad. But for some reason, when I actually launch FFXI and start the program, all of my keyboard and mouse manipulations just stop working altogether. The program is still running, and the Robot class is still able to read pixel colors. But Robot.keyPress, Robot.keyRelease, Robot.mouseMove, Robot.mousePress and Robot.mouseRelease all do nothing. It's the strangest thing-- to test it, I wrote a simple loop that just keeps typing letters, and focused notepad. I'd then start the game, refocus notepad, and it would do nothing. Then I'd exit the game, and it'd start working again immediately.
Has anyone else come across something like this, where specific software will stop certain functions of java from working?
Also, to make this more interesting-- Last year I wrote a very similar program using the same classes and programming techniques to automate healing a party in the game as they fight. Last year, this program worked perfectly. After running into these problems I dug up that old program, ran it without making any changes, and found that it too was having the same problems. The only differences between now and when it was working: I was running Windows Vista and now I'm running Windows 7, and several new Java versions as well as FFXI versions have been released.
What the hell is going on? (if anyone needs to see my source code, email me at mikejturley#gmail.com. I'm trying to keep it to myself.)
FFXI has code to prevent cheating. Quite effectively, it would seem.
If possible, try it in WinXP. I myself have also written a bot for an online game that uses much of the same concepts (i.e. using Java Robot to read pixel colors and simulate key-presses and mouse-clicks).
Under WinXP:
Bot works as intended in all cases.
Under Win7:
Outside of the game, bot works as intended. Ingame, simulated input failed (pixel reads were okay, I think).

Categories

Resources