Java daemon best cross platform solution? [closed] - java

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I have to build Java daemon process that once starts will always be working (and listening to an open socket) in Linux, Windows and Mac.
I saw a few solutions on the web, but didn't find anything consistent and widely used. What are developers using for such task?

Simplest way to do it is to create batch file(win)/shell script(linux) and invoke that in inittab (linux) or windows startup. That's makes life easier. In that batch/shell file, simply call java binary with parameters
java background/daemon/service cross platform best practices

Use javaw from an system execute command in a c program in windows to make the "nicest" deamon in windows. Then have the c program loaded into the registry under startup, or place it in the startup folder, but that is easely edited by your customers which may not be desireable.
Otherwise the command prompt window will keep bugging you/your client.
For linux & mac etc... it's easy, simply load the java command into init.d
Don't know if I'd prefer java as a deamon though.... It's a bit bulky compared to a c deamon.

Related

Creating Java application but whenever I run on eclipse it slow down my system.why? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I am Creating an Application in core Java Language. I have almost completed but I have notice that whenever I run this application in Eclipse after 3-4 times run.My system gets too slow I have tried in other systems too.This application also effect those system too.please give me some suggestions what should I do?
This probably means your application doesn't terminate. Check how many processes Eclipse is currently running in the Debug perspective. When your application ends, you will see <terminated> in front of the process entry in the "Debug" view.
If your application is still running, Eclipse will start a new process but the running application will eat CPU and memory. If your computer starts to swap, it will become (very) slow.
Also you might have given Eclipse too much memory. Check with the task manager of your OS how much memory you have and how much Eclipse uses.

Cross-platform in java [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
What are the cross-platform development principles in java? What problems are waiting me? I want to create cross-platform file manager (java se).
Technically Java only runs on one platform, the JVM. What you may have in mind is a cross operating system application. The most basic challenge is handling / and \ correctly.
However, the biggest problem you are likely to face is in the GUI providing a windows friendly interface on windows, mac friendly on mac and linux friendly on linux. This is an interface design issue rather than a coding issue.
You can get lots of articles on platform independency of java. Check this Oracle Documentiation on how java works.
You can go through this post how-is-java-platform-independent also.
So the key thing to keep in mind avoid doing platform specific things in your javacode
Do not execute OS Specific commands or scripts(you may be tempted to do that for things like checking disk space, but java has platform idependant implementation for that)
Avoid direclty depending OS variables(gettting home dir etc)

Windows programming in Java? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
What is a easy to learn framework or technique for windows-programming (calling win32 api) in Java?
I need to be able to access the windows api to do things such as send keystrokes, open applications, restart windows, etc.
The easiest for me has been to make small utility programs with AutoIt version 3 and then have my Java programs call these utility programs. The programs can communicate via input and output streams. If I want to delve deeper into windows, JNA is the way to go and there are lots of examples on how to use this here and at its site. JNI is another way (JNA uses JNI actually), but I find it more difficult as my C is quite rusty.
Edit:
Many folks have suggested using a Robot object, but the problem I have had with using Robot is that you can't enumerate the non-Java windows and then activate the desired window through Java alone. Also, you can't interact directly with window controls as you can with JNA and with AutoIt.
For send keystrokes, you can use java java.awt.Robot, and for open application, java.lang.ProcessBuilder is there. There API are os independent.
And for restart windows, maybe also use ProcessBuilder to call "shutdown" command, see here.
Shutdown Windows with Java

JConsole alternative [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
Does there exists any JConsole alternative which i could bundle with my app ?
If you are looking for a command line alternative Jmxterm would be a good option.
It almost have all the features Jconsole supports but not the GUI.
Can get it downloaded from Download JMXTERM Here
Not a real answer but maybe helpful. I just stepped over one of your last questions and think, these JConsole/JMX questions are still related to your work on a plugin for the hudson CI. The idea is to have a button on the Hudson UI to start a JConsole or any other managing application.
Thinking about that - Hudson has a web interface. Assume, you use hudson from a remote machine and press your JMX console button, I bet, the console is started on the server and not on the client and therefore inaccessible. So using an existing managing application (java application) limits you plugin to single-workstation uses of hudson. or you go the hard way and integrate not only the launch button but as well a web interface (based on JMX) that allows managing your servers directly from the hudson console.
Provided you are happy with running Sun-only classes, you can launch JConsole via
java com.sun.jconsole.JConsole
and hence directly from your application. Just call JConsole's static main() method.
Nagios with nagios-jmx-plugin

Is there Java library or framework for accessing Serial ports? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
Is there a java library or framework (other than the javax.comm provided by Sun) that is easy to use when accessing serial and parallel ports ( especially RS-232 ).
I need something free that will work both on Windows and Linux.
The most common framework used for this is rxtx.
As andri pointed out RXTX is pretty much your best choice. There is an article on getting started with RXTX on Windows here (relating to RXTX 2.1).
If free isn't necessary -- remember, your time isn't free -- then Serial IO SerialPort might be useful. It's the only thing I found that works as-is on all of the following:
32/64-bit Windows
64-bit Solaris (didn't test 32-bit)
32 bit Linux (didn't test 64-bit)
Mac OS X
You do get source with the product, albeit with some weird and annoying build practices.
FWIW, I'm just a contented user, not affiliated with the company.
rxtx as the other posters have said. I've been using it and it works nicely. There is a problem if using nonstandard highspeed baudrates (multiples of 115200 e.g. 230400, 921600 are OK, but 1MB is not even if the hardware & underlying OS supports it), I've been told this will be corrected in rxtx 2.2.

Categories

Resources