Python Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPython Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 13th, 2004, 03:10 AM
ferrari ferrari is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 1 ferrari User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question need to convert python code to java

I have a code in python.As i have to my coding in Java,and infact started other part of the coding in java. Now i need to change certain code written in python to Java.
Can anyone suggest me a wayout.

Reply With Quote
  #2  
Old November 13th, 2004, 04:34 AM
Rayman1986 Rayman1986 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 66 Rayman1986 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 h 49 m 43 sec
Reputation Power: 5
Would it not benefit you to switch to coding in Jython? I'm not sure, I;ve only read little bits on Python/Jython.

Reply With Quote
  #3  
Old November 13th, 2004, 04:56 PM
DevCoach DevCoach is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Feb 2004
Location: London, England
Posts: 1,254 DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level)DevCoach User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 1 Week 6 Days 8 h 9 m
Reputation Power: 265
As Rayman says, it is possible to mix python and Java code with Jython. Jython is the Python language implemented in Java, so you can call Java code from Jython, and compile Jython classes into object that can be accessed from Java.

There are disadvantages to this - Jython only implements the version 2.1 features of Python, so no list comprehensions or generators. Not all the Python libraries are available either, but since you have all the Java libraries available that is not a big issue.

Alternatively you could use a Java-Python bridge such as Jpype which allows you to interface Python and Java code.

If neither of these appeals, you can always recode the Python toJava or the Java to Python. Converting Java to Python is easier IMHO, since there are few language structures in Java that do not have an equivalent in Python, but Python has many features that would be hard to convert to Java.

Dave - The Developers' Coach.

Reply With Quote
  #4  
Old November 13th, 2004, 09:30 PM
Boki's Avatar
Boki Boki is offline
A wanna-be guru of some sort
Dev Shed Novice (500 - 999 posts)
 
Join Date: Sep 2004
Location: Either online or offline
Posts: 624 Boki User rank is Sergeant (500 - 2000 Reputation Level)Boki User rank is Sergeant (500 - 2000 Reputation Level)Boki User rank is Sergeant (500 - 2000 Reputation Level)Boki User rank is Sergeant (500 - 2000 Reputation Level)Boki User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 2 Days 4 h 7 m 13 sec
Reputation Power: 14
Why don't you post some or all of your code so people can estimate whether it can be (which probbaly can) and with how much trouble converted to Java?

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPython Programming > need to convert python code to java


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT