This week's book giveaway is in the Reactive Progamming forum.
We're giving away four copies of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams and have Adam Davis on-line!
See this thread for details.
Win a copy of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams this week in the Reactive Progamming forum!

Joe Ess

Bartender
+ Follow
since Oct 29, 2001
Joe likes ...
Linux Mac OS X Windows
Cows and Likes
Cows
Total received
13
In last 30 days
1
Total given
0
Likes
Total received
347
Received in last 30 days
1
Total given
2
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Rancher Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Joe Ess

Reminds me of the only other ukulele remake I've ever heard:

17 hours ago
How are you creating these reports (i.e. writing to stdout or creating files with Java IO or some third party library)?   What command line options are there and do any control output?

Perry Davies wrote:
Unfortunately I cannot show any code as its copyright.



Can you create a short, self contained, correct example  that exhibits this behavior?  

vinoth sathi wrote:
Is spring boot is usefull for middleware ?



That depends on what you mean by "middleware".  Spring is a collection of more than a dozen different projects, many of which could fulfill a middleware role (Spring Integration, Cloud, IO, etc.).  Spring Boot makes it easier to get those different projects to play well together.

vinoth sathi wrote:
Can you suggest front end page?



Do you mean a web front end framework?  Spring MVC is the Spring web front end.  There are several other projects that add capabilities to that base (Spring Session, Web flow, Web services, etc.).  
I got a negative comment about that kind of code (testing a boolean var) in a college assignment.  The professor said that it showed a fundamental misunderstanding about how the language worked.  So, yea, I'd have a dim view of seeing that construction in professional code.
The worst style argument I've seen is two coworkers arguing over this (advocated by the Sun Java Style Guide):

verses this (advocated by the JavaRanch Style Guide):


They went around for a year or so until the proponent of the latter style left the team and the proponent of the former stormed through the entire code base updating every instance.  
1 week ago
Have a look at this tutorial.  You don't manage the property files themselves.  You set a Locale and let Java determine what properties are correct.
1 week ago

Angus Ferguson wrote:It is working for Windows but not Linux...



That would not surprise me.  The Windows command line and Unix shell are not exactly functionally equivalent.  
I will say that I can execute the following:


So that would point to the issue being with the command to invoke Motu and not the Java or Python code.  I think using "bash" is superfluous in this case.
What does your current code look like and what is the output?
1 week ago

Angus Ferguson wrote:In my view, it looks like the URL can not reach the "outside world" because it belongs to a process.



I don't think that makes sense.  If the URL is reachable from the command line, it should be reachable from inside a process.

One issue I see is this code:

ProcessBuilder can take a String command or a String command followed String arguments.  I believe this command would fail because you passing "python -m motuclient..." as an argument to "python"

As we discussed before, you are not printing out the error stream.  
1 week ago
I think Dave has some good points.  I don't think this code is helpful:



All that is going to print out is a class name and an address.  What you want to do is print the contents of that stream.
As Dave points out, that code is troubling:


Note that read operations block until data is available or the stream is terminated.  If the Python process hangs or is waiting for input, your Java program stops working.
I am getting inconsistent results including "python" in the command line.  Try it both ways.
There's a really good article on this subject here.  Look at the examples and they should help.
2 weeks ago
Can you share your current code?
2 weeks ago


It is also curious that when I remove "python" in the exec method it doesnt find the .py file.



You are using a relative path.  You need to add a slash before "org" to make it absolute.  Also, there's no need to put two slashes.
2 weeks ago
Also, make sure to print BOTH output streams.  I think you are only printing out the contents of the error stream.
2 weeks ago

Angus Ferguson wrote:



Are you on Unix?  Because that's the wrong path separator for Unix.
2 weeks ago

Angus Ferguson wrote:When debugging it doesn't launch exception in fact I think that it doesn't execute the Python script...



Did you recompile after removing "sudo"?
Note the values for process (below).  You wouldn't have a PID and hasExited would not be true if the process has not executed.
However, note that exitcode is 2.  A non-zero exit code indicates a command-line error.  Is your script executable? Do you have a shebang in your Python file?  Try using the full path to the script in the argument to exec.
2 weeks ago
If you invoke "sudo", the OS will prompt you for your credentials, so this process will not complete (unless you send the credentials to the process via an OutputStream)
Your original code didn't catch the exception, which is crucial for solving this issue.  If you remove "sudo" what exception do you get?
2 weeks ago