I want to start a Windows program on virtual machine from Linux.
Are there opportunities to start a program directly on VM from the outside.
I tried WINE to emulate this program, but it does not work.
One idea I have, to implement WebService on the virtual machine and call this from Linux.
The web service would then call the program under Windows and play back the result.
Has anyone experience or better ideas?
Perhaps install freeSSHd on the Windows box, generate some public/private keys between your two servers, connect through to Windows and use use the cmd runas command to start your program/service.
Related
I work on a Macbook and I would like to close some running applications such as Remote Desktops through using Java.
I'm quite new to programming in Java and other than Google and StackOverflow I'm not sure where to go. I already looked for a solution on Google but all I can find are instruction on how to close Java on Mac OS, not actually how you close a running application through Java code.
So I am looking for some pointers on what Java commands I should use to close a running application in Mac OS. Thank you very much :)
While programming in Java, you only have access to do things inside the JVM. But your code inside the JVM wouldn't usually have permissions to affect other processes running on the operating system.
You can definitely call an external command with something like this:
Process process = Runtime.getRuntime().exec("kill 12345");
That would run the kill command on process id 12345. This would work, assuming you have the right permissions.
You can get more information on the exec command in the docs: https://docs.oracle.com/javase/7/docs/api/java/lang/Runtime.html#exec(java.lang.String)
I have a java program that should run on a Windows machine. It should run "forever", i.e. when the JVM or the program crashes, it should be restarted. When the computer is restarted it should also be restarted.
I saw advice to wrap the program as a "Windows service", but the tools I found seem to be either costly, complicated or outdated.
Can somebody describe me a straightforward way to achieve the desired behaviour?
For the part where you want to start the program after restart you can create a simple batch (.Bat) file and u can put that file in the startup folder.
Also you can use the same file for running the program when it crashes. you can use tasklist command and check if your java program is running and if it is not .just start the program.
Just check our windows batch this is one of the best things you can get everything for doing anything on windows without anything expensive
Yet Another Java Service Wrapper is a tool that easily wraps your Java program into a Windows service. Just start the program, note down the PID and enter it into the wrapper. Two things, which are probably universal to services, should be noted:
For connection to the network, you need to specify an account with the necessary rights.
Connected network drives are not available.
Is Java Virtual Machine starts before user logged in or it's start after boot windows.?
Every time you start a java program, a new instance of the Java Virtual machine is started. It stops when the program ends.
In the case of a java applet, the browser will invoke the virtual machine itself.
When a Java application starts, a runtime jvm instance is born. When the application completes, the instance dies. If you start four Java applications at the same time, on the same computer, using the same concrete implementation, you'll get four Java virtual machine instances. Each Java application runs inside its own Java virtual machine.
JVM starts when it's required, in other words as soon as you need an environment to run your Java code, meaning when you start your application.
Try googling for "when JVM starts", it should yield a lot of results which address this question (in Java and also for other languages using JVM). For example this page. Look for "The lifetime of a Java Virtual Machine".
In Windows "Java Virtual Machine" is simply "java.exe" executable.
It will start whey you will start it - manually, by putting it to autorun or by creating Windows Service.
It is the same as any other background application.
JavaFX 2 is not support Linux yet. Does this mean a client Linux machine (user machine) cannot run it or a server Linux machine (host machine) cannot run it or both?
*EDIT:*
JavaFX is for rich client. So the server will not run it, but store it and client will get it and run it, right?
JavaFx depends on hardware acceleration to run. This is currently not supported on linux (expected 2012). So if your server is executing JavaFx code, then it would not run on the server. If it is only delivering code to clients, like in an applet, then it would work.
It means you can't use the JavaFX libraries on a machine running Linux. Neither a client Linux machine, nor a server Linux machine can use them.
Response to Edit
You can still store and serve JavaFX code on Linux machines. You just can't execute the JavaFX code on a Linux machine.
Note that JavaFX is different from Java. You can still use Java on Linux machines.
I realize this question was posed a while back (11/2011), but I thought it might help to point out the related Open Source project from the OpenJDK community called OpenJFX. Feel free to help out with development, if you're qualified to do so as well. Given the secure nature of Linux, this project should prove a secure/safe way to utilize the "hardware acceleration to run"; though, it's still in the development stages.
Take a look at the project wiki to learn how to build OpenJFX on Linux.
I am going to create a Desktop application in Java. I don't know whether user having JAVA VIRTUAL MACHINE or not.
My questions are:
I want to know whether its possible to run Java application in a machine that doesn't contains JVM.
If its possible, I want to know whether this case is possible, I will created a application say MyApps, I will to convert this as .exe file and if user clicks MyApps.exe it should run my Java application and install JVM and run in that machine.
Use webstart, and to install java automatically, see the great comment of Andrew Thompson.
Then the user is free to use Solaris, Mac or Linux if he likes.
and updates for the JVM will be shipped to him. You don't need to rollout a new update for every bugfix in the JVM or Java-libs.
You can run a Java application on a machine which does not have a JVM, provided you install the version of Java you need first.
You can create an application which will install java as required and then run your application. However you cannot write this in Java (unless you have a JVM installed already)
This is not completely pointless as many system have some version of Java but may not have the version you need.
Nope, you need a JVM to run the Java bytecode. The only solution would be to transform the bytecode into a different executable format.
Finally I got the solution for running my Java application without Java Virtual Machine, by bundling JRE in the exe file. I did this by using the following link.
It's really working awesome.
JAVA without JVM using Launch4J
If we maintain the Directory Path as given we can get .exe with JRE bundled that will run without JVM.