Cross-platform in java [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.
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)

Related

Java daemon best cross platform solution? [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 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.

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

Which Java native compilers can be recommended? [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 would like to know which Java native compilers can be recommended to compile Java code to Windows and Mac OS X binaries.
Maybe someone knows which compilers have been used to create the Eclipse binaries. Those shouldn't be a wrong choice.
See here... But in short, there is no good solution that I would really recommend.
Eclipse uses as User Interface SWT, which uses the native plattform user Interface:
On Windows it looks like Windows, on Mac like Mac, etc.
Its available for the most popular Plattforms, search for SWT for more info.
So that is probably what you saw, or more are feeling when you work with eclipse.
Its not only the exe extension.

Choosing between .NET and Java to run on Mac and PC [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.
I need to write software that would be running on both Windows and Mac.
What is the better technology to fulfill this requirement?
Well, to run .NET you will need to use Mono since the Microsoft .NET can't be installed on non-windows machines.
However using Java you can run it on PC, OSX (Mac) and Linux. I would choose Java.
Well this is very augmentative question but it depends on what you already know. If you know java very well that go with it. If you know C# then you have mono to go with for mac. So its your choice. Since Mono is been actively updated and improved you will have no problem with features.
I'm mostly into .NET. However, in this case I agree Java will be most suitable.
Its easy, try Java. This is platform independent :) Where as .net is a cross-platform language. So have a look at Java :)

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