Calling python from java : py4j.Py4JException: An exception was raised by the Python Proxy. Return M

2,853 views
Skip to first unread message

sudheera Navaratne

unread,
Oct 17, 2015, 9:20:11 PM10/17/15
to Py4J Support and Comments
Hi

 I am trying to use py4j to call python method from java. I was successful in calling java methods from python. But I need to initiate the call from java side as java is my main program and I want to interface a power system simulation software called PowerFactory  to java via python, (python provide nice interface to handle the PowerFactory ) .

      So, When I try to call the python from java I get following error.


ERROR:py4j.java_gateway:Unknown command runPowerFactory
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python33\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 685, in runfile
    execfile(filename, namespace)
  File "C:\Python33\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 85, in execfile
    exec(compile(open(filename, 'rb').read(), filename, 'exec'), namespace)
  File "C:/Program Files (x86)/DIgSILENT/PowerFactory 15.1/python/PhdTheses_extClass.py", line 44, in <module>
    abc = toFromjava_ex.CollectDemandData(toFromjava1)
  File "C:\Python33\lib\site-packages\py4j\java_gateway.py", line 813, in __call__
    answer, self.gateway_client, self.target_id, self.name)
  File "C:\Python33\lib\site-packages\py4j\protocol.py", line 308, in get_return_value
    format(target_id, ".", name), value)
py4j.protocol.Py4JJavaError: An error occurred while calling o7.CollectDemandData.
: py4j.Py4JException: An exception was raised by the Python Proxy. Return Message: x

    at py4j.Protocol.getReturnValue(Protocol.java:434)

    at py4j.reflection.PythonProxyHandler.invoke(PythonProxyHandler.java:113)

    at com.sun.proxy.$Proxy0.runPowerFactory(Unknown Source)

    at repastextrun.JavaPyCall.CollectDemandData(JavaPyCall.java:10)

    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

    at java.lang.reflect.Method.invoke(Unknown Source)

    at py4j.reflection.MethodInvoker.invoke(MethodInvoker.java:231)

    at py4j.reflection.ReflectionEngine.invoke(ReflectionEngine.java:381)

    at py4j.Gateway.invoke(Gateway.java:259)

    at py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:133)

    at py4j.commands.CallCommand.execute(CallCommand.java:79)

    at py4j.GatewayConnection.run(GatewayConnection.java:209)

    at java.lang.Thread.run(Unknown Source)





+++++++++++++++++++++++++++++++++++++++++++++++++++
My java Interface looks like

package repastextrun;

public interface javaPyCallInt {
   
    public void runPowerFactory();
   
       
}

+++++++++++++++++++++++++++++++++++++++++++++++++

And the java class that I'm calling python looks like

package repastextrun;
import java.io.IOException;

import py4j.GatewayServer;

public class JavaPyCall {
   
    public void CollectDemandData(
javaPyCallInt javaInt) throws IOException{
       
        javaInt.runPowerFactory();
        System.out.println(javaInt);
    }
   
    public static void main(String[] args) {
        GatewayServer server = new GatewayServer(new JavaPyCall());
        server.start();
    }



}

Thanks
Sudheera

Barthelemy Dagenais

unread,
Oct 17, 2015, 9:39:44 PM10/17/15
to sudheera Navaratne, Py4J Support and Comments
Hi, thanks for using Py4J!

What does the Python code looks like (specifically, the code that implements the javaPyCallInt interface, the code that creates the JavaGateway, and the code that creates an instance of the Python class implementing javaPyCallInt and that sends it to the Java side)?

Barthelemy

--
You received this message because you are subscribed to the Google Groups "Py4J Support and Comments" group.
To unsubscribe from this group and stop receiving emails from it, send an email to py4j+uns...@py4j.org.
To post to this group, send email to py...@py4j.org.
To view this discussion on the web visit https://groups.google.com/a/py4j.org/d/msgid/py4j/1a3b92f5-2a7b-45eb-9490-68b11cbd8b06%40py4j.org.

sudheera Navaratne

unread,
Oct 17, 2015, 9:51:07 PM10/17/15
to Barthelemy Dagenais, Py4J Support and Comments
Hi

 Sorry I forgot to include the Python code. here it is...

from py4j.java_gateway import JavaGateway
import os
import sys
import powerfactory


class ToFromjava(object):
   def runPowerFactory():
       try:
           pyd_PATH = r'C:/Program Files (x86)/DIgSILENT/PowerFactory 15.1/python'
           sys.path.append(pyd_PATH)
           app = powerfactory.GetApplication()
           app.Show()
           project = app.ActivateProject("Final project(2)") #Nine Bus System
           prj = app.GetActiveProject()
       except ValueError:
           print("Oops!  not a valied call...")
       
   class Java:
        implements = ['repastextrun.javaPyCallInt']
   

if __name__ == '__main__':
    logger = logging.getLogger("py4j")
    logger.setLevel(logging.DEBUG)
    logger.addHandler(logging.StreamHandler())
    gateway = JavaGateway(start_callback_server=True)
    toFromjava = ToFromjava()   
    toFromjava_ex = gateway.jvm.repastextrun.JavaPyCall()
    toFromjava_ex.CollectDemandData(toFromjava)



Thanks
Sudheera
--
Sudheera Navaratne 

Barthelemy Dagenais

unread,
Oct 17, 2015, 10:07:09 PM10/17/15
to sudheera Navaratne, Py4J Support and Comments
Hi,

the code looks good, but I see in the stack trace:


": py4j.Py4JException: An exception was raised by the Python Proxy. Return Message: x"

Can you add a generic exception handler in runPowerFactory(), something like:

try:
    ...
except ValueError:
    ...
except Exception:
    from traceback import print_exc
    print_exc()

Thanks,
Barthelemy

On Sat, Oct 17, 2015 at 9:20 PM sudheera Navaratne <sudhee...@gmail.com> wrote:
--

sudheera Navaratne

unread,
Oct 17, 2015, 11:01:31 PM10/17/15
to Barthelemy Dagenais, Py4J Support and Comments
Hi

    I added an exception handler as you described. But still getting the same error.
 Below is the new python code

class ToFromjava(object):
   def runPowerFactory():
       try:
           pyd_PATH = r'C:/Program Files (x86)/DIgSILENT/PowerFactory 15.1/python'
           sys.path.append(pyd_PATH)
           app = powerfactory.GetApplication()
           app.Show()
           project = app.ActivateProject("Final project(2)") #Nine Bus System
           prj = app.GetActiveProject()
       except Exception:
           from traceback import print_exc
           print_exc()
       
   class Java:
        implements = ['repastextrun.javaPyCallInt']
   




if __name__ == '__main__':
    #logger = logging.getLogger("py4j")
    #logger.setLevel(logging.DEBUG)
    #logger.addHandler(logging.StreamHandler())
    logging.disable

    gateway = JavaGateway(start_callback_server=True)
    toFromjava = ToFromjava()   
    toFromjava_ex = gateway.jvm.repastextrun.JavaPyCall()

Thanks
Sudheera
--
Sudheera Navaratne 

Barthelemy Dagenais

unread,
Oct 18, 2015, 6:11:13 AM10/18/15
to sudheera Navaratne, Py4J Support and Comments
Hi,

Thanks for the feedback.

When I ran this code, the exception contained a bit more information:
TypeError: runPowerFactory() takes 0 positional arguments but 1 was given

1. Add self to the python method: def runPowerFactory(self):

2. Remove System.out.println(javaInt) in the Java code (toString is not implemented by the python side) or implement toString in your Python class.

This now works for me,
Barthelemy

sudheera Navaratne

unread,
Oct 18, 2015, 9:53:31 AM10/18/15
to Barthelemy Dagenais, Py4J Support and Comments
Hi 
 
  Thanks for your help Barthelemy. It works now. But I had to restart my computer to get it to work. Some one java or python has executed the old program even though I modified it. (My guess is it's Python). I'm using Spyder with Python 3.3 for my python work and Eclipse for my java work.

    I'll post under the same heading if I encounter any other problem due to this strange behavior. 

Thanks
Sudheera
   
--
Sudheera Navaratne 

sudheera Navaratne

unread,
Oct 18, 2015, 11:54:46 PM10/18/15
to Barthelemy Dagenais, Py4J Support and Comments
Grate,

     Everything Is working fine now. I was able to call the PowerFactory software from Python, collect data to Python list and pass it to java program. I did everything from a test program written in eclipse.

     Now it's time to transfer this (all the classes and methods) to my original java code. This is an agent based modelling platform called "Repast Simphony". Repast has It's own main code which runs in background to run the user interface and then execute the classes.

**** I'm using Eclipse for java editing

And I get following error .....

**************************************************************************************************************************************
Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: py4j/GatewayServer
    at psplanning.util.JavaPyCall.StartGateway(JavaPyCall.java:23)
    at psplanning.psplanningContextBuilder.build(psplanningContextBuilder.java:65)
    at repast.simphony.dataLoader.engine.ClassNameContextBuilder.build(ClassNameContextBuilder.java:41)
    at repast.simphony.dataLoader.engine.DataLoaderControllerAction.runInitialize(DataLoaderControllerAction.java:48)
    at repast.simphony.engine.controller.DefaultController$2.visit(DefaultController.java:214)
    at repast.simphony.engine.controller.DefaultController$2.visit(DefaultController.java:1)
    at repast.simphony.util.collections.NaryTree.preOrderTraverals(NaryTree.java:292)
    at repast.simphony.util.collections.NaryTree.preOrderTraverals(NaryTree.java:295)
    at repast.simphony.util.collections.NaryTree.preOrderTraverals(NaryTree.java:295)
    at repast.simphony.util.collections.NaryTree.preOrderTraversal(NaryTree.java:288)
    at repast.simphony.engine.controller.DefaultController.runInitialize(DefaultController.java:212)
    at repast.simphony.engine.controller.DefaultController.runInitialize(DefaultController.java:383)
    at repast.simphony.ui.RSApplication.initSim(RSApplication.java:157)
    at repast.simphony.ui.action.InitRun.actionPerformed(InitRun.java:17)
    at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
    at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
    at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
    at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
    at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
    at java.awt.Component.processMouseEvent(Unknown Source)
    at javax.swing.JComponent.processMouseEvent(Unknown Source)
    at java.awt.Component.processEvent(Unknown Source)
    at java.awt.Container.processEvent(Unknown Source)
    at java.awt.Component.dispatchEventImpl(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Window.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
    at java.awt.EventQueue.access$500(Unknown Source)
    at java.awt.EventQueue$3.run(Unknown Source)
    at java.awt.EventQueue$3.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
    at java.awt.EventQueue$4.run(Unknown Source)
    at java.awt.EventQueue$4.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(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)
Caused by: java.lang.ClassNotFoundException: py4j.GatewayServer
    at org.java.plugin.standard.StandardPluginClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    ... 51 more

*********************************************************************************************************************************************

I red some were that Eclipse maintains separate class hierarchies for different jar files. Is this due to that? and how can I overcome this?
I also found that there is separate py4j for eclipse and couldn't find the .jar file. 

My Python access code is in JavaPyCall.java and corresponding interface is javaPyCallInt.java. The method StartGateway()  in JavaPyCall.java starts the Gateway and is called from "psplanningContextBuilder.java"


The classes are packaged like this

Inline image 1


 

***************** JavaPyCall.java ********************************************

package psplanning.util;

import java.io.IOException;

import py4j.GatewayServer;

public class JavaPyCall {
    public String[][] demandPass;
   
    public void CollectDemandData(javaPyCallInt javaInt) throws IOException{
       
        javaInt.runPowerFactory();
        javaInt.runPF();
        String[][] demand = javaInt.findDemandPoint();
        System.out.println(demand[0][3]);
        System.out.println(demand[1][4]);
    }
   
    public static void StartGateway() {

       
        GatewayServer server = new GatewayServer(new JavaPyCall());
        /**
         * GatewayServer.turnLoggingOn();
         * Logger logger = Logger.getLogger("py4j");
         * logger.setLevel(Level.ALL);
        **/
       
        server.start();
      }
}

**********************************************************************



**************************javaPyCallInt.java***************************

package psplanning.util;


public interface javaPyCallInt {
   
    public void runPowerFactory();
    public void runPF();
    public String[][] findDemandPoint();
   
       
}

************************************************************************



**************************
psplanningContextBuilder.java********************************

@Override
    public Context<Object> build(final Context<Object> context){
        //TODO Auto-genetate method stub
       
        final Logger LOGGER = Logger.getLogger(psplanningContextBuilder.class.getName());
        JavaPyCall pycall = new JavaPyCall();
        pycall.StartGateway();

        /**
         * Open gateway for Python to access java
         */
        try {
            pyEntryPoint py = new pyEntryPoint();



Thanks
Sudheera      
--
Sudheera Navaratne 

Barthelemy Dagenais

unread,
Oct 19, 2015, 4:06:46 PM10/19/15
to sudheera Navaratne, Py4J Support and Comments
Hi,

The error "Caused by: java.lang.ClassNotFoundException: py4j.GatewayServer" indicates that the jar file is not found.

If you are using Eclipse as an IDE and you are not developing an Eclipse plug-in, you only need py4j.jar and you do not need Py4J for Eclipse.

The jar needs to be added to the classpath of the project. A simple way is to add the jar file to your project, right-click and select something like "Add to build path" (if I remember correctly).

Barthelemy

sudheera Navaratne

unread,
Oct 19, 2015, 4:44:59 PM10/19/15
to Barthelemy Dagenais, Py4J Support and Comments
Hi Barthelemy

   I already have py4j.jar in my build path. But still getting this error.

Thanks
Sudheera
--
Sudheera Navaratne 

sudheera Navaratne

unread,
Oct 20, 2015, 1:45:22 AM10/20/15
to Barthelemy Dagenais, Py4J Support and Comments
Hi 

 I ran the command
         System.out.println(System.getProperties());

And this is what I got. Don't see the py4j in class path. But I have it in Properties--> Java build path in eclips

Any Idea what's going on??

Some things that might interest is highlighted. I have a worry about applicationRoot. It says

          applicationRoot=C:\RepastSimphony-2.3.1\eclipse\plugins\repast.simphony.

Does this mean it runs as a plugin project?
         If it is the case I might need the py4j for eclipse?



++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
{java.runtime.name=Java(TM) SE Runtime Environment,
sun.boot.library.path=C:\Program Files (x86)\Java\jre1.8.0_60\bin,
java.vm.version=25.60-b23,
java.vm.vendor=Oracle Corporation,
java.vendor.url=http://java.oracle.com/,
path.separator=;,
java.vm.name=Java HotSpot(TM) Client VM,
file.encoding.pkg=sun.io, user.country=US,
user.script=,
sun.java.launcher=SUN_STANDARD,
sun.os.patch.level=Service Pack 1,
java.vm.specification.name=Java Virtual Machine Specification,
user.dir=F:\Agents\Repast Agents\Stupid Model Dir\psplanning,
java.runtime.version=1.8.0_60-b27,
java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment,
java.endorsed.dirs=C:\Program Files (x86)\Java\jre1.8.0_60\lib\endorsed,
os.arch=x86, java.io.tmpdir=C:\Users\Sudheera\AppData\Local\Temp\,
line.separator=,
java.vm.specification.vendor=Oracle Corporation,
user.variant=,
os.name=Windows 7,
apple.laf.useScreenMenuBar=true,
applicationRoot=C:\RepastSimphony-2.3.1\eclipse\plugins\repast.simphony.
runtime_2.3.1\,
sun.jnu.encoding=Cp1252,
java.library.path=C:\Program Files (x86)\Java\jre1.8.0_60\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program Files (x86)/Java/jre1.8.0_60/bin/client;C:/Program Files (x86)/Java/jre1.8.0_60/bin;C:/Program Files (x86)/Java/jre1.8.0_60/lib/i386;C:\ProgramData\Oracle\Java\javapath;C:\Python33\Lib\site-packages\PyQt4;C:\Python34\;C:\Python34\Scripts;C:\Python33\;C:\Python27\Lib\site-packages\PyQt4;C:\Program Files (x86)\Measurement Computing\DAQ\;C:\Perl64\site\bin;C:\Perl64\bin;c:\windows\system32;c:\windows\system32\wbem;c:\windows\system32\windowspowershell\v1.0\;c:\progra~2\egcs\bin;c:\progra~2\pscad4~1\bin\ffilter;c:\program files (x86)\nvidia corporation\physx\common;c:\program files (x86)\miktex 2.8\miktex\bin;c:\windows;c:\program files (x86)\common files\roxio shared\oem\dllshared\;c:\program files (x86)\common files\roxio shared\oem\dllshared\;c:\program files (x86)\common files\roxio shared\oem\12.0\dllshared\;c:\program files (x86)\roxio\oem\audiocore\;c:\program files (x86)\ntru cryptosystems\ntru tcg software stack\bin\;c:\program files\ntru cryptosystems\ntru tcg software stack\bin\;c:\program files\dell\dell data protection\access\advanced\wave\gemalto\access client\v5\;
c:\program files (x86)\microchip\mplab c32 suite\bin;c:\program files (x86)\hi-tech software\picc\9.83\bin;c:\program files (x86)\microsoft sql server\100\tools\binn\;c:\program files\microsoft sql server\100\tools\binn\;c:\program files\microsoft sql server\100\dts\binn\;C:\Program Files\MATLAB\R2013b\runtime\win64;C:\Program Files\MATLAB\R2013b\bin;c:\program files\matlab\r2012a\runtime\win64;c:\program files\matlab\r2012a\bin;c:\program files (x86)\gridlab-d\lib;c:\program files (x86)\gridlab-d\bin;c:\gnuplot\bin;d:\resy-pmc\poe\sys\poet\runtime\bin;d:\resy-pmc\sys\bin;c:cygvin\usr\local\ns2\ns-allinone-2.35\bin;c:cygvin\usr\local\ns2\ns-allinone-2.35\tcl8.5.10\unix;c:cygvin\usr\local\ns2\ns-allinone-2.35\tk8.5.10\unix;C:\Windows;C:\Users\Sudheera\AppData\Local\Smartbar\Application\;C:\Program Files\Java\jdk1.7.0_51\bin;C:\Program Files\MATLAB\R2013b\polyspace\bin;C:\Program Files\Microsoft Network Monitor 3\;C:\Program Files (x86)\MiKTeX 2.9\miktex\bin\;C:\Python27;C:\Python27\DLLs;C:\Python27\Scripts;C:\Python27\gnuplot\binary;C:\Program Files (x86)\pythonxy\SciTE-3.5.1-4;C:\Program Files (x86)\pythonxy\console;C:\Program Files (x86)\Skype\Phone\;C:\Program Files (x86)\scm\;C:\Program Files\Java\jdk1.7.0_51\bin;c:\Python27\Lib\idlelib;C:\ProgramData\chocolatey\bin;C:\tools\cygwin;C:\Python33\Lib\site-packages\spyderlib;;C:\RepastSimphony-2.3.1;;.,

sun.awt.enableExtraMouseButtons=true,
java.specification.name=Java Platform API Specification,
java.class.version=52.0,
sun.management.compiler=HotSpot Client Compiler,
os.version=6.1, user.home=C:\Users\Sudheera,
user.timezone=America/Chicago,
java.awt.printerjob=sun.awt.windows.WPrinterJob,
file.encoding=Cp1252,
java.specification.version=1.8,
java.class.path=C:\RepastSimphony-2.3.1\eclipse\plugins\org.codehaus.groovy_2.3.7.xx-201411061335-e44-RELEASE\lib\groovy-all-2.3.7.jar;C:\RepastSimphony-2.3.1\eclipse\plugins\org.codehaus.groovy_2.3.7.xx-201411061335-e44-RELEASE\lib\bsf-2.4.0.jar;C:\RepastSimphony-2.3.1\eclipse\plugins\org.codehaus.groovy_2.3.7.xx-201411061335-e44-RELEASE\lib\ivy-2.3.0-sources.jar;
    C:\RepastSimphony-2.3.1\eclipse\plugins\org.codehaus.groovy_2.3.7.xx-201411061335-e44-RELEASE\lib\ivy-2.3.0.jar;C:
\RepastSimphony-2.3.1\eclipse\plugins\org.codehaus.groovy_2.3.7.xx-201411061335-e44-RELEASE\lib\servlet-api-2.4.jar;C:\RepastSimphony-2.3.1\eclipse\plugins\repast.simphony.runtime_2.3.1\bin;C:\RepastSimphony-2.3.1\eclipse\plugins\repast.simphony.runtime_2.3.1\lib\saf.core.runtime.jar;
    C:\RepastSimphony-2.3.1\eclipse\plugins\repast.simphony.runtime_2.3.1\lib\commons-logging-1.1.2.jar;C:\RepastSimphony-2.3.1\eclipse\plugins\repast.simphony.runtime_2.3.1\lib\javassist-3.17.1-GA.jar;C:\RepastSimphony-2.3.1\eclipse\plugins\repast.simphony.runtime_2.3.1\lib\jpf.jar;C:\RepastSimphony-2.3.1\eclipse\plugins\repast.simphony.runtime_2.3.1\lib\jpf-boot.jar;C:\RepastSimphony-2.3.1\eclipse\plugins\repast.simphony.runtime_2.3.1\lib\log4j-1.2.16.jar;
    C:\RepastSimphony-2.3.1\eclipse\plugins\repast.simphony.runtime_2.3.1\lib\xpp3_min-1.1.4c.jar;C:\RepastSimphony-2.3.1\eclipse\plugins\repast.simphony.runtime_2.3.1\lib\xstream-1.4.7.jar;C:\RepastSimphony-2.3.1\eclipse\plugins\repast.simphony.runtime_2.3.1\lib\xmlpull-1.1.3.1.jar;C:\RepastSimphony-2.3.1\eclipse\plugins\repast.simphony.runtime_2.3.1\lib\commons-cli-1.2.jar, user.name=Sudheera, java.vm.specification.version=1.8, sun.java.command=repast.simphony.runtime.RepastMain
    F:\Agents\Repast Agents\Stupid Model Dir\psplanning/psplanning.rs,

java.home=C:\Program Files (x86)\Java\jre1.8.0_60, sun.arch.data.model=32, user.language=en, java.specification.vendor=Oracle Corporation, awt.toolkit=sun.awt.windows.WToolkit, java.vm.info=mixed mode, java.version=1.8.0_60,
java.ext.dirs=C:\Program Files (x86)\Java\jre1.8.0_60\lib\ext;C:\Windows\Sun\Java\lib\ext, sun.boot.class.path=C:\Program Files (x86)\Java\jre1.8.0_60\lib\resources.jar;C:\Program Files (x86)\Java\jre1.8.0_60\lib\rt.jar;C:\Program Files (x86)\Java\jre1.8.0_60\lib\sunrsasign.jar;C:\Program Files (x86)\Java\jre1.8.0_60\lib\jsse.jar;C:\Program Files (x86)\Java\jre1.8.0_60\lib\jce.jar;C:\Program Files (x86)\Java\jre1.8.0_60\lib\charsets.jar;C:\Program Files (x86)\Java\jre1.8.0_60\lib\jfr.jar;C:\Program Files (x86)\Java\jre1.8.0_60\classes, java.vendor=Oracle Corporation, file.separator=\, java.vendor.url.bug=http://bugreport.sun.com/bugreport/, sun.io.unicode.encoding=UnicodeLittle, sun.cpu.endian=little, sun.desktop=windows, sun.cpu.isalist=pentium_pro+mmx pentium_pro pentium+mmx pentium i486 i386 i86}

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


Thanks
Sudheera

--
Sudheera Navaratne 

Barthelemy Dagenais

unread,
Oct 20, 2015, 10:33:19 AM10/20/15
to sudheera Navaratne, Py4J Support and Comments
Hi,

here are a few screenshots of a Java project in Eclipse that works with the py4j jar file. I don't think from the properties you pasted that you are working on an Eclipse plug-in.

It's possible though that your Run configuration has some particuliar settings or is not taking into account your build path (see screenshot of the classpath).

Can you add the jar of another library and access it (e.g., some apache commons lib)?

Barthelemy



On Tue, Oct 20, 2015 at 1:45 AM sudheera Navaratne <sudhee...@gmail.com> wrote:
Hi 


image.png





--
Sudheera Navaratne 



--
Sudheera Navaratne 
Screenshot 2015-10-20 10.28.15.png
Screenshot 2015-10-20 10.27.07.png
Screenshot 2015-10-20 10.27.35.png

sudheera Navaratne

unread,
Oct 20, 2015, 10:37:17 AM10/20/15
to Barthelemy Dagenais, Py4J Support and Comments
Hi Barthelemy

     Thanks for your help. Finally got it resolved. There is a lib folder in the project where I can add my .jar file. It seems It takes the jar files from there not from the class path,

 It works and it's amazing how I can integrate all three programs and fetch the results.

 Thank you again for your help.

Sudheera

 
--
Sudheera Navaratne 
Reply all
Reply to author
Forward
0 new messages