From: Wayne P. <wa...@mi...> - 2002-02-18 07:08:39
|
I haven't worked with Jython in a while, so I thought I'd build a simple Applet to refresh my memory. I copied the code from the web site below: from java.applet import Applet class HelloWorld(Applet): def paint(self, g): g.drawString("Hello from Jython!", 20, 30) I then used jythonc to create a .jar file and have the following in my HTML: <applet code='HelloWorld' archive='hello.jar' width=200 height=200> <applet> But when I load the HTML page all I see is a grey box. I've tried several different versions of the above line, mostly in the code attribute. jythonc didn't give any errors except for the "using depreciated...". I'm testing this with Sun's JDK 1.4 . Does anyone know what I'm overlooking? Thanks, Wayne |
From: rbill <rb...@di...> - 2002-02-18 18:42:30
|
On Sun, 17 Feb 2002, Wayne Pierce wrote: > I haven't worked with Jython in a while, so I thought I'd build a simple > Applet to refresh my memory. I copied the code from the web site below: > > from java.applet import Applet > > class HelloWorld(Applet): > def paint(self, g): > g.drawString("Hello from Jython!", 20, 30) > > I then used jythonc to create a .jar file and have the following in my HTML: > > <applet code='HelloWorld' archive='hello.jar' width=200 height=200> > <applet> > > But when I load the HTML page all I see is a grey box. I've tried > several different versions of the above line, mostly in the code attribute. > > jythonc didn't give any errors except for the "using depreciated...". > I'm testing this with Sun's JDK 1.4 . Does the browser you are using have plugin support for JDK 1.4? Without plugins, use jdk 1.1.8 to compile applets. If this is no help, forward the options given to jythonc and the java console output. |
From: Wayne P. <wa...@mi...> - 2002-02-19 05:20:19
|
rbill wrote: > On Sun, 17 Feb 2002, Wayne Pierce wrote: > >>I haven't worked with Jython in a while, so I thought I'd build a simple >>Applet to refresh my memory. I copied the code from the web site below: >> >>from java.applet import Applet >> >>class HelloWorld(Applet): >> def paint(self, g): >> g.drawString("Hello from Jython!", 20, 30) >> >>I then used jythonc to create a .jar file and have the following in my HTML: >> >> <applet code='HelloWorld' archive='hello.jar' width=200 height=200> >> <applet> I found one problem, the file I created was 'hello.py' but the class was 'HelloWorld'. When I changed them to match the error I was getting before went away...and I got a new one. :-( > Does the browser you are using have plugin support for JDK 1.4? Without > plugins, use jdk 1.1.8 to compile applets. If this is no help, forward > the options given to jythonc and the java console output. I didn't load the applet plugin, but this time I did test it with appletviewer.exe and got the following output: java.lang.NoClassDefFoundError: org/python/core/PyProxy at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:512) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:12 6) at java.net.URLClassLoader.defineClass(URLClassLoader.java:249) at java.net.URLClassLoader.access$100(URLClassLoader.java:57) at java.net.URLClassLoader$1.run(URLClassLoader.java:196) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:189) at sun.applet.AppletClassLoader.findClass(AppletClassLoader.java:134) at java.lang.ClassLoader.loadClass(ClassLoader.java:309) at sun.applet.AppletClassLoader.loadClass(AppletClassLoader.java:114) at java.lang.ClassLoader.loadClass(ClassLoader.java:265) at sun.applet.AppletClassLoader.loadCode(AppletClassLoader.java:470) at sun.applet.AppletPanel.createApplet(AppletPanel.java:551) at sun.applet.AppletPanel.runLoader(AppletPanel.java:480) at sun.applet.AppletPanel.run(AppletPanel.java:293) at java.lang.Thread.run(Thread.java:539) When I compiled with 'jythonc -jar hello.jar hello.py' I got the following output: Warning: -jar is deprecated, use --jar processing hello Required packages: java.applet Creating adapters: Creating .java files: hello module hello extends java.applet.Applet Compiling .java to .class... Compiling with args: ['c:\\jdk\\bin\\javac', '-classpath', 'C:\\jython\\jython.j ar;;.\\jpywork;;C:\\jython\\Tools\\jythonc;C:\\Xitami\\webpages\\.;C:\\jython\\L ib;C:\\jython', '.\\jpywork\\hello.java'] 0 Note: .\jpywork\hello.java uses or overrides a deprecated API. Note: Recompile with -deprecation for details. Building archive: hello.jar Tracking java dependencies: I've tried moving the HTML file and the .jar into the jpywork directory with no luck. I'm not sure what to try next, I even tried another program from Jython_for_Java_Programmers. That program worked fine when typed interactively but didn't work when I tried to make a .jar and run it. Thanks for any help, Wayne |
From: Syver E. <syv...@on...> - 2002-02-19 15:32:08
|
Hi Wayne, could you tell us excactly what you do to make the applet. I'm thinking of HTML code, where is the jar file, exactly what compilation options do you use and so on, I think it would help in diagnosing your problem. A thought, I didn't see that you used the --core switch to jythonc, this is required if you don't provide jython.jar in the list of archives in the applet tag in your html code. Btw, the java plugin works fine on my machine (win2k pro, ie 6, java 1.4) -- Vennlig hilsen Syver Enstad |
From: Wayne P. <wa...@mi...> - 2002-02-23 04:43:32
|
That was the problem, when I crated the applet I used --jar but not --core and it couldn't find jython.jar . When I used --core and --jar it works fine, I also know what the problem with the JDK plugin was. The site I was visiting (hushmail.com) had an older applet that did not use the new permission and access rules for 1.4. So the plugin was working fine, it was just that every site I visited was using older versions of applets. Thanks for all of your help, Wayne Syver Enstad wrote: > Hi Wayne, could you tell us excactly what you do to make the applet. > > I'm thinking of HTML code, where is the jar file, exactly what > compilation options do you use and so on, I think it would help in > diagnosing your problem. > > A thought, I didn't see that you used the --core switch to jythonc, > this is required if you don't provide jython.jar in the list of > archives in the applet tag in your html code. Btw, the java plugin > works fine on my machine (win2k pro, ie 6, java 1.4) > -- Wayne Pierce web: http://www.mishre.com email: wa...@mi... "What you need to know." |