Windows programming 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 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

Related

I want to make a simplified Java game engine [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 9 years ago.
I want to make a Java game engine that would be simple to use mainly for it would have a higher level language interpreter. I though about using Lua language with the LuaJ intertpreter, but I've got some really slow results...
I need suggestions for what other Lua-like languages (With a Java interpreter available) exist that (with an interpreter) could execute faster (than LuaJ) on my Java application.
In the domain of game programming, Java itself is considered slow. I would suggest that you can start with code generation facility built on top of Java. I have worked extensively on Drools , Groovy and similar DSLs and can vouch they are "slow" for even a typical enterprise app. One problem is the dynamic interpretation layer built over java. You can see the typical performances in this comparison study at http://www.slideshare.net/michael.galpin/performance-comparisons-of-dynamic-languages-on-the-java-virtual-machine
If you can work on creating a language which generates code before compiling, you will get best of both world. This doesn't mean you will need to know compiler theory stuff from day one. You can simply create utility functions in Java which you can distribute as client library. However, you will need to know Reflections thoroughly to approach the solution in this way. As nobody changes the code in a running production server, you will be perfectly fine.

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.

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)

How to quickly prototype Java code? [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.
Interpreted languages are nice, I can write some quick, prototypical code (i.e. using an interactive shell) for the purpose of exploration before delving into production level code.
What is the best approach for this with Java? Currently I'm creating Maven projects with Eclipse, and exploring things in my test infrastructure using JUnit... but this is less then ideal.
You can also check out Eclipse's Scrapbook Page:
Menu>File>New>Other>(search for)Scrapbook Page
Why not use something like BeanShell ? It's a scripting solution for Java and offers a console-based interactive scripting environment.
Here's the quick start guide. Note that you can also start a BeanShell console from within Maven.
I've picked BeanShell here since it's the closest thing to Java, but interactive. You could pick another console-based JVM language such as Scala, Jython etc. They're more removed from standard Java since they're different languages, but still offer interoperability with your standard Java components.
You might want to try out JRebel for quick code tweaking. Or if you are into web development, check Play framework.
http://zeroturnaround.com/software/jrebel/
http://www.playframework.org/

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 :)

Categories

Resources