Can you program external application from Java/C++ app.? [closed] - java

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
Can you program external application from Java app.?
I know this is a wierd question but lately I really need to do it.
So the lets say I have "VLC" player or MPC or whatever it is, I want to be able to create a Java/C++ application or whatever it is to control the application such as play the video, pause the video and stuff.
If it possible please let me know and how.

It's certainly possible with VLC. Look here: http://wiki.videolan.org/Java_bindings as well as here: how to control VLC by java
For MPC, I don't know of any resources that can be used to do so. You can at least launch it to the best of my knowledge.

To start (execute) an external application you should use Runtime.getRuntime().exec(params);
or ProcessBuilder class.
http://docs.oracle.com/javase/7/docs/api/java/lang/ProcessBuilder.html
See Execute external program in java for more information.
To send key strokes to another application you could use the "Robot" class (http://docs.oracle.com/javase/6/docs/api/java/awt/Robot.html).

What is expected is to have access to interface to do these operations, you can get some references from http://caprica.github.io/vlcj/
This is java api for controlling the VLC instance embedded in AWT.

I have found this site that describes how to run external programms from java
http://www.rgagnon.com/javadetails/java-0014.html

Related

Can I transfer Java code from Eclipse to Andriodstudio? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed last month.
Improve this question
I have developed a game with Java in Eclipse, I would now like to take this 1 to 1 and make it into an app, how can I do this? Is that possible? Can I transfer this to Andriod Studio?
I donĀ“t know how i could make this. Do you know a video or an intruduction?
The android JAVA is kinda tricky. It violates the Java principle of Write Once Run Anywhere
To transfer any java project to android, it is best to:
Separate your Java code that handle UI from the one that handles the logique (its even better to wisely organize the project into packages
create a new blank android project
copy the logique Java code/classes to java resource folder
Convert the UI Java code/classes into android activities

How to display values form a python program output in a Swing GUI developed in Java [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I am trying to create a graphical user interface (GUI) using Swing in Java.
The part I am kind of stuck is, I am planning to display some values from my Python program to the interface I am developing in Swing. I have looked up in forums and came across the Jython thing, but not quite sure on how to proceed with this, anyone information in this issue would be helpful to me.
Some extra information, if it may help, I have a set of sensors reading some values using a Raspberry Pi, and the sensors are operated using a Python script running in RPi. Now my goal is to develop a GUI using Java so that I can display those values from the Python script to the swing interface.
Thanks in advance.
I think your easiest path forward would be to store the values that are collected by the Raspberry Pi in an intermediary storage. This can be as simple as a text file, or if you want something more verbose, you can store it in a RDBMS or NoSQL DB. Then it becomes easier for the java application to look up the values without having to interface with Python.
If you want to directly interface with Python, you could look into GraalVM which has limited ability to directly execute Python code.

How do I pass variable(s) from a VB.NET application to an already running Java application on the same computer? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I hope this doesn't sound silly. I've looked it up but can't find anything.
Let's use this example to keep from being too general. In my VB.NET application, I want to do this:
Dim ASDF As String = "This is a string."
Dim UIOP As Integer = 54
From here, I want to send the values of these variables to a Java application that is already running locally on my computer - I don't want the program to start the application because it is already running. What would be the simplest way to achieve this? Thanks for your help!
I had a similar problem once which involved passing information from a Python program to a C++ application which was already running, same as in your case.
The most reliable solution I could find was to simply have the first program create a text file with the relevant info, and then have the second program read and destroy the file. This solution works really well if you only have to pass information between programs a few times, not continuously.
A more structured way of doing the same thing, instead of using a text file, would be to use an XML file. Both Java and VB.NET support XML data parsing, VB.NET with XmlTextReader and Java with Document Object Model. Using xml will allow you to have a hierarchical structure for your data.

Porting an app from Java to Python [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I have written an RTMPS client a while back and needed it for my Django application but since Java and Python don't play well without using system calls (I don't want to use Jython) I wanted to rewrite the application in Python.
Would it work if I ported it as if to Python from Java? Of course we have to take into account the obvious things like multiple constructors have to be done differently in Python. Are there any other things that would not make it work in Python?
I am doing this because Java is so memory heavy and hoping that moving in into Python would reduce memory footprint and thus allow my web app to use it.
I would suggest rewriting it completely but there are a lot of differences to take into account. Here's a starter for recognizing some of the common differences/mistakes: http://dirtsimple.org/2004/12/python-is-not-java.html
Also if you are too lazy to rewrite the code (like me) there is an other option: java2python

Can I use my Java code to develop an Android app? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I'm in the early midst of making a game with Java, and would eventually like to turn it into an android application.
All the developer technical stuff aside, will the code itself remain the same, or will I have to rework the better part of it?
Thanks in advance for the feedback
Yes,you can do like that where your rendering part need to be changed if you want to use it in android. So the better option is use some framework to port your code to work in Android system as well. LibGdx is such a kind of framework where you can develop and test your application in stand alone mode and without changing your code, you can run it in Android as well. Please refer LibGDX site for more information
Android code is java, so yes!
You'll have to change some stuff. For instance, if you're using swing to show stuff on the screen, you'll have to change it to use the android API; but the core of the code should remain the same.
I remember doing my very first videogame in java. Porting it to android only required me to modify little.

Categories