Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8791639
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T22:52:16+00:00 2026-06-13T22:52:16+00:00

I have a jython script in which I need to call a java method

  • 0

I have a jython script in which I need to call a java method for processing some logic.

And here is my jython script:

from sets import Set
....
names = Set(["Alice","Bob","Charles"])

// call a java method
Test.removeNames(names)

The removeNames in the Test class takes java.util.Set as parameter. And after running the script, I got a TypeError:

TypeError: removeNames(): 1st arg can't be coerced to java.util.Set

I tried to use java.util.Set in my jython script and it worked. However, I just wonder is there a way for the java method to recognize jython object??

Thanks!!!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T22:52:16+00:00Added an answer on June 13, 2026 at 10:52 pm

    Jython documentation says that automatic type conversion (coercion) happens wherever needed. But only some Jython types (refer the list given in Jython documentation) can be converted to Java type and viceversa.

    For other types, I guess the Java type objects have to be used to pass as a param to a Java method.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need some example Jython, or Java, code to exec an interactive OS shell
myRs=myStmt.executeQuery(select i_col,col_name from tab_col) i=0 while (myRs.next()): list= myRs.getString(I_COL)+','+myRs.getString(COL_NAME) i have a jython code
Basically I have a script in Python that grabs the text from an open
We have an existing java-based heavyweight project that needed an interactive script interpreter. After
I have a Jython script that I run as a daemon. It starts up,
I currently have some automation written in Sikuli at the Jython layer, but I
I wonder if it possible to not have jython automagicaly transform java objects to
I have a Java project that utilizes Jython to interface with a Python module.
I am using Jython within a Java project. I have one Java class: myJavaClass.java
I have a Jython script properly running on a Windows 7 machine with PostgreSQL

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.