« Return to Thread: Applet Help

Applet Help

by Neil M. :: Rate this Message:

Reply to Author | View in Thread

Hi, I'm trying to run a Java Applet with a Java Swing GUI but using a
python library as a backed.  I've packed it all into a .jar that runs
fine as a standalone Java app.  When I move it to the webserver it seems
to be issuing HTTP requests (see attached log) for various imports and I
have no idea why.  Something with the classpath or pythonpath?  Any ideas?

Neil

--------------- modified jython factory ----------------------
   public static Object getJythonObject(String interfaceName,
                                        String pathToJythonModule){

       Object javaInt = null;
       PythonInterpreter interpreter = new PythonInterpreter();
       //interpreter.execfile(pathToJythonModule);
       interpreter.exec("import " + pathToJythonModule);
       //String tempName =
pathToJythonModule.substring(pathToJythonModule.lastIndexOf("/")+1);
       String tempName =
pathToJythonModule.substring(pathToJythonModule.lastIndexOf(".")+1);
       //tempName = tempName.substring(0, tempName.indexOf("."));
       //System.out.println(tempName);
       String instanceName = tempName.toLowerCase();
       String javaClassName = tempName.substring(0,1).toUpperCase() +
                           tempName.substring(1);
       //String objectDef = "=" + javaClassName + "()";
       String objectDef = "=" + pathToJythonModule + "." + javaClassName
+ "()";
       interpreter.exec(instanceName + objectDef);
       //System.out.println(instanceName + objectDef);
        try {
           Class JavaInterface = Class.forName(interfaceName);
           javaInt =
                interpreter.get(instanceName).__tojava__(JavaInterface);
        } catch (ClassNotFoundException ex) {
            ex.printStackTrace();  // Add logging here
        }

       return javaInt;
   }


-------------------- HTTP Log --------------------

[Sun Jun 14 18:50:40 2009] [error] [client X] File does not exist:
/download_test/stat$py.class

[Sun Jun 14 18:50:41 2009] [error] [client X] File does not exist:
/download_test/stat$py.class
[Sun Jun 14 18:50:42 2009] [error] [client X] File does not exist:
/download_test/java
[Sun Jun 14 18:50:45 2009] [error] [client X] File does not exist:
/download_test/java
[Sun Jun 14 18:50:46 2009] [error] [client X] File does not exist:
/download_test/java
[Sun Jun 14 18:50:46 2009] [error] [client X] File does not exist:
/download_test/java
[Sun Jun 14 18:50:47 2009] [error] [client X] File does not exist:
/download_test/org.class
[Sun Jun 14 18:50:47 2009] [error] [client X] File does not exist:
/download_test/org.class
[Sun Jun 14 18:50:48 2009] [error] [client X] File does not exist:
/download_test/org
[Sun Jun 14 18:50:48 2009] [error] [client X] File does not exist:
/download_test/org
[Sun Jun 14 18:50:49 2009] [error] [client X] File does not exist:
/download_test/org
[Sun Jun 14 18:50:50 2009] [error] [client X] File does not exist:
/download_test/org

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Jython-users mailing list
Jython-users@...
https://lists.sourceforge.net/lists/listinfo/jython-users

 « Return to Thread: Applet Help