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

  • Home
  • SEARCH
  • 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 9032859
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T08:04:58+00:00 2026-06-16T08:04:58+00:00

I wrote a class in java which i want to execute in python using

  • 0

I wrote a class in java which i want to execute in python using jython.
First the error I am getting?

Traceback (most recent call last):
  File "/Users/wolverine/Desktop/project/jython_scripts/customer.py", line 3, in <module>
    customer = Customer(1234,"wolf")
TypeError: No visible constructors for class (Customer)

My Java class format:

public class Customer {
    public final int customerId;
    public final String name;
    public double balance;

    /*
     *  Constructor
     */
    Customer(int _customerId, String _name){
        customerId = _customerId;
        name = _name;
        balance = 0;
    }

My python 2 lines script

import Customer

customer = Customer(1234,"wolf")
print customer.getName()

The directory structure is like

 folder/customer.py    folder/Customer.java folder/Customer.jar

I went to folder and did

    %javac -classpath Customer.jar *.java

And then my jython is in Users/wolverine/jython/jython

To execute I do this

       %/Users/wolverin/jython/jython ~/Desktop/folder/customer.py

And again the error is :

   Traceback (most recent call last):
  File "/Users/wolverine/Desktop/project/jython_scripts/customer.py", line 3, in <module>
    customer = Customer(1234,"wolf")
TypeError: No visible constructors for class (Customer)

Disclaimer. I just started using java 🙁

  • 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-16T08:05:02+00:00Added an answer on June 16, 2026 at 8:05 am

    The Customer class isn’t in your package, and your constructor isn’t public. That’s why you’re getting the error you see – the constructor isn’t visible to your python code (which is in another package effectively)

    Change your constructor line from

    Customer(int _customerId, String _name){
    

    to

    public Customer(int _customerId, String _name){
    

    And it should work fine. In addition, you may find this question helpful on understanding how public / protected / private / default work.

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

Sidebar

Related Questions

I have a shell script which I want to execute within a Java class.
I quickly wrote a linked list class in Java. I want to write another
i want to code a manager program in java which will execute a c
I write a java class which has many getters..now I want to get all
So I recently wrote a java class that extends exception and used an instance
I wrote some code to read a file in my Java Servlet class. (I'm
I have a short question i have wrote this in java. Old code: class
i am trying to write a program in java (on linux) using RandomAccessFile class
I'm using a framework called Processing which is basically a Java applet. It has
I wrote a software application in Java. Now I want to deliver it to

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.