By JoOngle on
I'm trying to run a Commodore-64.jar (java) file, that works perfectly when it's on it's own (non-drupal) web-page.
How do I make it run (eg...with the text editor in Drupal)?
The java box shows up, but entirely white (eg..the program won't run) Drupal runs something else?
Comments
=-=
What input format is in use?
have you tried using plain text and the php input format? (which is why the editors provide the ability to bypass them)
Hi, and thanks for your
Hi, and thanks for your reply!
Yes, I switch to Source mode when I enter the java applet text. The "java" box appears as it should, but the program seem to interfere with something else that Drupal runs...as it's "stopped" or dysfunctional. Funny thing is - it runs nicely on it's own Html page though, but not as raw code in Drupal....
Code snippet:
End code snippet.
Not sure about what you mean by "input format"?
=-=
input formats are what allows code to be rendered on output and whether those tags are stripped or not. More information on input formats in the documentation area.
My solution
I don't know if you got your applet running, but here is how I did mine.
I made a directory in sites/default/files called myapplets, then in myapplets created bounce, the name of my applet.
Then I put all of my class files and images used in that directory. Here is what my code looks like in the FCKEditor, (you have to click the Source button before pasting the code into the editor window if you use FCKEditor)
That worked for me just fine without using a jar file. If you use a jar file you have to put the path to the jar file in the codebase parameter and your main class name in the code parameter and that should work.
Let me know what results you get with this JoOngle.
Regards....
need help
I'm trying to run a jta26.jar applet that can be found on http://www.javassh.org/space/Installing+the+Applet but i am not able to make it work :(
I tried to follow your instrictions but still getting error. . . Can you help me with it and write a step by step walktrough please ?
sry for bad english
How to stop some programms
How to stop some programms from popin up while booting you PC?
SEO Singapore
Hi i have tried this for a
Hi i have tried this for a jar file and NOT got it working.
my html editer inside drupal shows this code
and when i view the page it gives an exception classNotFound.
it seems to be trying to open the raw class file but not trying to find it inside the jar.
any ideas how to make this work?
further info,
i have unzipped the jar on my server and changed names to match.
but now i get this error
Exception: java.lang.ClassNotFoundException: org.jpedal.examples.simpleviewer.AppletViewer
java.lang.reflect.InvocationTargetException
at com.sun.deploy.util.DeployAWTUtil.invokeAndWait(Unknown Source)
at sun.plugin2.applet.Plugin2Manager.runOnEDT(Unknown Source)
at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.security.AccessControlException: access denied (java.util.PropertyPermission user.dir read)
at java.security.AccessControlContext.checkPermission(Unknown Source)
at java.security.AccessController.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPropertyAccess(Unknown Source)
at java.lang.System.getProperty(Unknown Source)
at org.jpedal.examples.simpleviewer.Values.(Unknown Source)
at org.jpedal.examples.simpleviewer.SimpleViewer.(Unknown Source)
at org.jpedal.examples.simpleviewer.AppletViewer.(Unknown Source)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at sun.plugin2.applet.Plugin2Manager$12.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Exception: java.lang.reflect.InvocationTargetException
java.lang.NullPointerException
at sun.plugin2.applet.Plugin2Manager.findAppletJDKLevel(Unknown Source)
at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Exception: java.lang.NullPointerException
please any help appritiated.
UPDATE
UPDATE!!!
I have implemented my java applet now using a jar file. Since a few sent me messages asking for step-by-step instructions, here they are.
Make sure all of your class and resource files are in a single directory. In your code, when you reference an image or other resource file, you have to do it like this getImage(getCodeBase(),"path/name of resource file"). This helps the applet know where things are in the jar file!
Create a mainclass.txt file in the same directory containing this without the comments:
Change to the directory where your class and resource files are located.
Then create your jar file using this command: "jar cvfm name.jar *.class images sounds etc mainclass.txt"
name.jar is the name of your jar file, *.class means to include all .class files in the jar file, images sounds etc will include those directories, if they exist, and all of the files in them in the jar file, mainclass.txt is the manifest file that helps java know about the jar file and the main class file.
After I created my bounce.jar file, I then uploaded it to my web server in the directory sites/default/files/myapplets/bounce/
I created the myapplets and bounce folders to organize my applets in Drupal.
Then when you create content such as a story or page or create a comment, all you have to do is include this applet tag code:
Of course you will want to change the archive and code attributes to reference your files. And your applet should work just fine in Drupal then.
Here is mine working on my Drupal site
Enjoy!!!
Another Update
Code change!! I found that when using Google Chrome, the code above using the applet tag did not work. So I changed to this code using the object tag instead:
This works in all browsers.
executing java in localhost
James -
you seem to have a good handle on executing java from Drupal. I've tried these various code solutions, either from a Drupal page or straight html...not working. the java runs fine from a terminal comman line. Maybe it's because I'm trying in a localhost website on ubuntu? It seems whenever you throw enough variables at Drupal then it requires a novel fix. Any ideas for me on what additional steps I might need to take?
Thanks.
Art