Making program work on 32 bit Window OS - 32bit-64bit

I have written a program in Java on a 64 bit Window OS, but now I need my program to work on a 32 bit Window OS. How can I do this? (For making an exe file I used launch4j)

For Java, if the machine has the Java 32-bit is installed, then running the exe alone will be enough. If you want to provide redistributable, just use the java 32-bit redistributable.

Related

Running java application from usb

I am trying to build a cross platform (vista, xp, mac, Linux).
I need to put the application in the USB drive formatted in FAT-32 and it should run on any OS computers.
Planning to use Java/JavaFx to do it.
Any advice how we can run on the multiple platforms.
Hi, Can anyone advice use of uber-jar for the above requirment. Would that be good fit.
A few things to take into consideration:
The USB must be formatted with a filesystem compatible with all the OS you need to work with.
A Java application would be able to run on any OS that is able to run Java, but each OS needs a different Java runtime. There's a Java runtime for Linux, one for Windows, one for OSX, etc.
My suggestion would be to define which OS you want to support and create launcher scripts for each one of them on the root of the USB. For instance you would have at least a couple like: myapp.cmd (for Windows), myapp.sh (for Linux), etc.
Additionally you may want to have different Java Runtimes in the same USB, so with the launcher scripts you execute your Java application running it with the corresponding JRE in the USB filesystem.
A twist in the launcher script would be to somehow check if the OS has already a JRE available (Like checking for a variable JAVA_HOME in the environment, or checking the output of "java -version") and act accordingly (although, running a Java application from your own JRE would be safer).

Qt/MinGW32 memory usage limitation?

I wrote an application with Qt 4.8.1 and MinGW32 (Nokia Qt SDK). I try to load a large file with this app, but the app always crash when memory usage reach 1,868 MB. If I reduce the size of input file the app works fine. Is there any memory limitations on Qt apps or MinGW32? What should I do if I really want my app to use more memory? My windows is 64 bit.
p.s. Adding "QMAKE_LFLAGS_WINDOWS += -Wl,--stack,32000000" to .pro file won't work
Thanks very much!
p.p.s. I saw many software are capable of using 10+ GB, e.g. Matlab, how to do that on Qt apps?
Your copy of windows may be 64 bit, but MingW32 is a 32 bit compiler, so any app written with that compiler has all the standard limits inherent to 32 bit Windows. Effectively, you won't be able to get more than around 2G of memory for your app to use.
There's a method to get that up to 3G, but beyond that you need a 64 bit compiler.
2GB is limit is for process only.
You can spread your application along N processes (32-bit) to allocate N x 2GB. Operating system must still be 64-bit.

Compile Qt Project on Windows for Linux / Mac

Is it possible to compile a Qt Project on Windows for Linux / Mac?
I am using Qt 5.0.2 with MinGW and Qt Creator.
i'm not saying it is impossible but it would be really hard. g++ could be tricked into generating object files but there are many linux libraries and headers that just don't exist on mingw. Linux apps are best built on linux itself.
For QT 4.* answer is YES, that's possible, I did that ones mainly for 'research purposes' and would not do it again ever.. It takes a lot of time, a lot of hacking bit's and pieces in makefiles, configurations.. There is no ANY practical sense in doing that. It takes 40 minutes to install Linux of your taste on a virtual machine (whatever you prefer) and get proper binaries.
Same applied for MacOSX.. never did it but again I believe it can be done by building a full tool-chain only question what for =))
In our organization we have 1 server with 3 virtual machines that are responsable for cross-platform building. I think that cross-compiling on one real OS may be used only for some kind of learning process, but not for real tasks.
I finally did it with compiling and building it on each OS. It is too much effort doing it on Widnows.

Why do pointers remain the same size in 64bit and 32bit systems?

I recently installed a 64bit OS on my computer, I thought that sizeof(char*) would give me 8 instead of 4. Shouldn't I get a 64 bit addresses in my pointers?
This is because the compiler you are using is emitting 32 bit code. If you use a 64 bit compiler then pointers will be 8 bytes wide.
Note that most 64 bit systems have the ability to run 32 bit code under an emulation layer. On Windows the emulation layer is known as WOW64. This is clearly what is happening here.
The OS typically has no effect on code generation. If you run the same compiler and the same libraries, you will get the same code out, regardless of whether the OS is 32-bits or 64-bits. You can compile and run 32-bit software on a 64-bit OS. You can compile 64-bit software on a 32-bit OS.
The compiler determines the type of code generated. The OS only determines whether you can run it.
Yes, you should, but note that a same operating system can run both 32-bit and 64-bit code, and that in the "64bit OS" you installed, the "64bit" may only mean "64bit able".
You really should give more detail here about the particulars of the OS. Mac OS X Snow Leopard , for instance, comes with versions of GCC and Clang that default to 64-bit code, and you can use option -m32 to generate 32-bit code. Perhaps the convention is reversed on your 64-bit OS (that is, you should use -m64 or a similar option)

Wrong Architecture when running executable from Xcode4 on UNIX

First of all, I'm very new to programming.
I have a build a program using Xcode 4 on Snow Leopard.
Architecture of the project is set to "Standard (32/64-bit intel)"
Afterwards I have exported the executable file to a UNIX computer for running.
ssh to that computer
Typing ./programname in the terminal (Of the UNIX computer) gives the following response:
Exec format error. Wrong Architecture.
The program runs just fine on my Mac laptop.
When you compile a program it will (*) be compiled for a specific platform and a specific operating system. It will also most likely be compiled against a specific set of libraries. Usually those parameters are exactly those of the computer doing the compilation (the other cases are called cross-compilation).
In other words: compiling a program on a Mac will produce a binary that runs only on a Mac (unless, again, you're doing cross-compilation). Your UNIX system (which UNIX, by the way?) has a different operating system, different libraries and probably even a different CPU architetcture.
Somewhat related: Apples advertised (or used to advertise) Mac OS X as a UNIX. While Mac OS X is certainly a UNIX-class operating system, that doesn't mean that it's binary compatible with every other UNIX-class OS out there.
* almost always, with the exception of systems designed to avoid this (e.g. Java)
Programs compiled by XCode will only run under MacOS X. Unless the "UNIX computer" in step 2 is running MacOS, the program will not be able to run.

Resources