I am a Mac user who wants to run a few .exe files from my Java process using Process and Runtime classes.
I know that it is not possible to execute .exe files in general in Mac OS X.
Is there a Mac application which can wrap these .exe files so that they can be executed ?
Does Apple provide anything by itself ?
The alternative I am using now is to run the Java process in Windows. Yet, it is cumbersome in general.
Darwine
Edit: I should probably point out that this is not a 100% solution. Virtualized Windows will nearly always work better, through Parallels or some similar virtualization software. But Darwine is free and runs most Windows software acceptably.
Besides wine you can get VirtualBox(free), Parallels($$$) or VMWare($$$).
Well, if it's a .NET application then you can possibly run it with Mono, but I'm betting it's a native binary and you'll have to use something like the aforementioned Wine. I thought it was really cool the first time I ran a .exe using Mono on OSX, it just felt wrong, so I had to share.
I don't know if it exists, but you would need something like wine for OSX. The reason why is that the .exe would nearly certainly use OS specific system calls and library functions.
EDIT: looks like it does exist
java -jar file.exe and monofile.exe both works natively on MACOS with native MACOS java and mono
1)Install Wine and Winebottler from http://winebottler.kronenberg.org/
2)You may have to change the System Preferences >Security & Privacy>Allow Apps downloaded from>Anywhere
2)Click the xyz.exe and select winebottler for running application
Related
My requirement is to copy a file that is on windows machine to Linux machine using the IP, User name and password of the windows machine using java code. I have the java code running on linux machine. I want to know the best way to achieve this. What is the procedure to achieve this?
You can use JCIFS to access a Windows share from Java on Linux or Windows.
Your code is running on the Windows machine, right? The most secure way would be to use SSH. http://www.jcraft.com/jsch/ looks like a pretty good implementation. It's used by ant, maven. etc, to do the same thing.
On the other hand, if you're not creating a new build system, could I suggest that perhaps your build system (ant/maven/gradle) should be copying your files around for you?
Can anybody give me suggestions about preparing a custom Mac Installer for a Java swing application. I have tried Xcode but of no use. Any suggestions would be really helpful.
Thanks in advance...
Take a look at http://izpack.org.
IzPack-generated installers only require a Java virtual machine to run. It is fully cross-platform and generates a single installer. As such, it is an alternative to native solutions like as platform-specific installers and package managers.
Or for a more Mac-specific option, see this 10-step tutorial:
http://www.centerkey.com/mac/java (Updated for Mac OS X 10.6 — Snow Leopard)
Do you actually need an installer? Unless you need to put files in very specific locations and need admin privileges for that, installers are uncommon on the Mac. Typically, you'd use a disk image with a self-contained application bundle. See my answer to this question. That answer also mentions how to create a standard OS X installer.
I wonder if you can load a DLL, of Windows operating system (for example, user32.dll), in an application (in any programming language) with a Linux operating system.
The DLL would be in a directory on the Linux file system.
Thanks for the help.
Greetings!
Yes, you can load a DLL and call its functions by using an appropriate wrapper library, but that's fundamentally useless if the DLL itself has dependencies on the platform which are not present. This approach is used for things like closed-source video codecs, where no (nontrivial) dependencies exist.
User32.dll is of course, part of the OS and intrinsically linked to many NT kernel functions, none of which exist in Linux. Wine does not make use of the Windows user32.dll, but provides its own version which gives equivalent functionality.
Loading Windows' user32.dll would definitely not be useful, as it is mostly going to be a wrapper for other DLLs, processes (for example CSRSS) and kernel calls which aren't present under Linux. You could load and use Wine's one though.
No. The architectures are fundamentally different.
I note your question is tagged C++. If it was a .net DLL (built with CLR bytecode) then you could reference it via an application running under Mono.
It's possible if you write a wrapper for it. That's how the win32 codecs work on Linux. Also Wine uses many DLLs.
You could probably do a custom Wine build (home page, Wikipedia page) for your application. We're talking about a big hammer here, though. :-)
DLL is a format for windows (i.e. it MS implementation of shared library concept).
It is not in a format that Linux understands.
Linux uses the ELF format for dynamic libraries.
Why do you want to do this? To execute a program (.exe) that uses that DLL? In that case you need a Windows emulator on your Linux machine, such as wine.
This problem is really befuddling me and hopefully someone could help me out. I've written some plugin libraries for a large java software. Everything works fine and well on my development computer. However, after I compiled and wrapped the software in Nullsoft Installer and install onto another computer, everything but the native dll plugins I developed runs, and I get a UnsatisfiedLinkError when I call System.loadLibrary. The installer works on my dev computer, the installed software runs fine even after I moved the original software. Here's what I do know:
the native libraries are deved in .NET (C++/CLI) hooked in by JNI
The software on the new computer is loading the right library path, can see the native dlls. In Java, I've added a segment to check the permissions on the files using File class, Java runs fine on library_dll.canRead() and library_dll.canWrite(), but hangs/crashes on library_dll.canExecute().
If anyone can help me, I would really appreciated it!!! Thank you all!
Does the target computer have .NET installed, and the right version of .NET at that?
I can't say I've ever done any .NET/JNI interop - it sounds potentially tricky to me. Have you looked at using JNBridge to make things easier?
Thanks Jon! No, the target computer does not have .NET installed (at least none more than the ones windows have at default). But it seems like JAVA/JNI can't even load the dll... I will try installing .NET framework and see
.NET/JNI interop was not the difficult part, that is working on my dev comp... It was tricky but not too difficult.
I would suggest that you run FileMon on the computer which is giving the problem, and then try to run your application. After FileMon captures data, you should see all file accesses made by your Java application and see the exact failure which leads to the UnsatisfiedLink error. For example, it may be that some dependency of your JNI DLL is missing on the other computer (this sounds like a good possibility, after security/permission errors).
A Java6 application sits in the system tray. It needs to be activated using a hotkey (e.g. Super-G or Ctrl-Shift-L etc) and do something (e.g. showing an input box).
How do I do that on:
Windows (XP or Vista)
OS/X
Linux (Gnome or KDE)
I've compiled a library for global hotkeys in java using JNA. It currently supports Windows, Linux and Mac OSX. It also supports media keys on windows and linux.
if anyone is interested, try https://github.com/tulskiy/jkeymaster
I would appreciate any feedback.
Thank you.
For Linux (X11) there is JXGrabKey: http://sourceforge.net/projects/jxgrabkey/
There is also a tutorial for grabbing a global hotkey on Linux: http://ubuntuforums.org/showthread.php?t=864566
I didn't though find a solution for OS X yet.
To build something for all 3 platforms I'd suggest stripping down JIntellitype (it's Apache license) to it's global hotkey functionality and extending it with the OS X and X11 functionality...
It seems that this is not doable in a cross-platform fashion without using the native interfaces.
On Windows, you can use the free JIntellitype library.
If anyone wants to do the OSX or Linux versions of the JNI part of Jintellitype I would be more than happy to add those to the JIntellitype library.
Melloware
http://www.melloware.com
I found this solution to work just great on windows. It does not require you to install any software like JIntelliType. Note that this is 32 bit dll and you can recompile for 64-bit JVM is do desire. All credits to original author of the blog.
I've written a Java library for global key/mouse events here. This works for Windows, Linux X11, and OSX.
https://github.com/repeats/SimpleNativeHooks