473,387 Members | 1,492 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

run python file from java class by eclipse IDE

This program (below), I am able to run from command prompt but when i am using eclipse that is not returning any text.

May this is not running python file

java file and python file is present in bin folder when i am using command prompt

when i am using eclipse java and python both file is present in default package .

what i do to run python file from java class by eclipse IDE ?
Expand|Select|Wrap|Line Numbers
  1. public class TestE 
  2. {
  3.     static String returnText(String s7) 
  4.     {    StringBuilder result=null;    
  5.     try{
  6.             final String command = "python sir_desc.py "+s7;
  7.             final Process sirDesc = Runtime.getRuntime().exec(command);
  8.  
  9.             final java.io.InputStream inStreamBase = sirDesc.getInputStream();
  10.  
  11.             final java.io.InputStreamReader inStreamISR = new java.io.InputStreamReader(inStreamBase);
  12.  
  13.             final java.io.BufferedReader inStream = new java.io.BufferedReader(inStreamISR);
  14.  
  15.             String inLine;
  16.  
  17.             result = new StringBuilder();
  18.  
  19.             while (null != (inLine = inStream.readLine()))
  20.  
  21.             result.append(inLine);
  22.  
  23.             }
  24.             catch(Exception e){}
  25.         return result.toString();
  26.     }
  27.  
  28.  
  29.  public static void main(String args[])
  30.  {
  31.      System.out.println("start  :  "+returnText("https://en.wikipedia.org/wiki/Varanasi"));
  32.  }
  33. }
Attached Files
File Type: txt sir_desc.py.txt (5.7 KB, 198 views)
Nov 18 '16 #1
0 1233

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Donovan | last post by:
Hello. I am interested in learning about and using the Eclipse framework and Java -- both of which are new to me. I have prior programming experience with VB.NET and c#.NET; but not Java. As...
4
by: angel | last post by:
A java runtime environment includes jvm and java class (for example classes.zip in sun jre). Of course jython need jvm,but does it need java class. Thanx
4
by: f | last post by:
I am writing a java code generation tool. The tool will take a java class description written in xml and translate it to java code using xslt. I am looking for samples of xml files that describe...
14
by: Bill | last post by:
I've written a small program that, in part, reads in a file and parses it. Sometimes, the file is gzipped. The code that I use to get the file object is like so: if filename.endswith(".gz"):...
0
by: napi | last post by:
We are pleased to announce the release of version '1.5.0' of AMPC (Axiomatic Multi-Platform C) C to Java class files compiler suite. It is Write Once Run Anywhere (WORA) with C. Detailed info...
16
by: Amir Michail | last post by:
Hi, It seems to me that measuring productivity in a programming language must take into account available tools and libraries. Eclipse for example provides such an amazing IDE for java that it...
0
by: neroliang | last post by:
PyLucene Homepage: pylucene.osafoundation.org 1.Quotas from PyLucene: """ Technically, the PyLucene programmer is not providing an 'extension' but a Python implementation of a set of methods...
1
by: dhwanimathur | last post by:
hi all i am trying to work in jsp's for that i am using tomcat server and dreamweaver IDE i have create a jsp now i want to call a class like calculate.java which i have designed in Eclipse...
0
by: gaya3 | last post by:
Hi All, In my project, am creating the application jar using one-jar. And am able to run the jar with java -jar Example.jar and its working fine. When i try to run from jnlp its throwing the...
0
by: rob9021 | last post by:
Hi Guys, I am using Java in Eclipse to create tables in a MySQL Database. Everything has been working fine until it inexplicably stopped working the other day. My code runs but nothing happens to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.