I am fairly new to Java and almost entirely new to writing Java on my phone. My laptop is broken and the replacement seems far off, so I'm trying to set up my phone as a complete replacement in the meantime.
Question:
I have termux with emacs for writing and CLDC for running jar files but I haven't found out how to convert my .java/.class files without Java's jar command. Is there a way to create a Java Archive while only using an Android phone?
You can try installing a GNURoot. Rooting your device is not required. Once installed, you will have access to a command line interface.
From there, you should be able to use apt-get install openjdk-7-jdk to install jar, and you may be able to use it to compile your source files.
Good luck!
Related
Previously I used Izpack to install my Java application, and when users want to install a new version they just reinstalled into the same location (C"/Program Files/Jthink/Jaikoz"), this would replace older files with newer files, and there was no need for user to uninstall old version first.
I have now built a installer using JPackage (now part of Java, JDK 14) for the latest version of the application, this continues to install to same location. The trouble is because JPackage enforces a new file structure (app and runtime subdirs) my files are no longer overwriting my existing files, so now I have the two installations all muddled up.
So I added some code in the latest version to delete the old no longer needed files when I started my application. But the trouble is this fails because I do not have permission to delete these files, I think this is because they were installed by installer (I am not sure)
e.g here we show groups of old files, only System and Administrators have permissions to modify/delete the files.
If I Run as Administrator then the code deletes the files without problem, but it is not usual for customer to run as administrator so this is no great help.
What are my options ?
It seems that you have to pass the following argument to jpackage to identify installers for the same application: --win-upgrade-uuid "your_uuid_string". As ever with Java/Oracle documentation, they could not have been more mysterious about this if they tried.
I've also found that I have to increment the version number, too, or else the installer will flash quickly and just hang in the background and do nothing (until you reboot or end the task): --app-version 1.0.1
You can generate a UUID here: https://www.uuidgenerator.net/
If you pass the argument "--win-per-user-install" to your jpackage command the msi will install the application under "C:/User/x/AppData/Local" and will have permission to write inside its own folder.
That only helps to cleanup files in the future, but old ones under C:/Programme I'm afraid I also don't know. If you can read the folder with your application. You certainly can give instructions from your application how users can cleanup old stuff themselves if you detect old files.
When the program is installing on windows, I want the installer to check if mysql is installed, and install it if it isn't (Or at very least give a link to the website so the user can install it)
I'm sure this is possible, I've been trying to figure this out for a while now. If you can have an installer check if the user has java installed and install it if they don't, then surely you can do the same for mysql?
Perhaps I'm looking at this the wrong way - should I instead be getting the java program to check if mysql is installed and install it then if it isn't? And if so, how do I do that?
Any help would be hugely appreciated, I've been stuck with this for a long time.
I refer to this answer.
Java is cross platform, MySQL isn't, so you'd have to create various installers for multiple platforms with different MySQL binaries.
My suggestion is to have a look around the web in order to find the correct way to create an installer depending on the OS you're using
Installer is usually created for OS (Windows, Linux). In our case we created deb package (for Debian) which checked if PostgreSQL and other prerequisites are installed and installed what is missing. So, basically it is job for installation script (in our case it was shell).
Wix installers along with .bat files you can use.
http://wixtoolset.org/
It has built-in directives that can check if software is installed or not, outdated version notifications also.But WIX is kind of a database of your software binaries.So you have to include the binaries of MySQL(whichever are supported on windows) in the installer using harvest wix utility.
http://wixtoolset.org/documentation/manual/v3/overview/heat.html
This will just copy the binaries in your target directory if the software is not installed, you have to write all this logic to skip or install using wix directives/conditional custom actions .To do after copy stuff like starting or configuring the service either write a bat/powershell file which will handle all this and you can invoke this powershell file from wix after the copy action using wix custom action directives.
http://wixtoolset.org/documentation/manual/v3/wixdev/extensions/authoring_custom_actions.html.
Or you can write all the steps of bat files in many different custom actions.You will need visual studio to create this installer.In the begining it will be trouble to understand how it works but this is the best way to create production level deployment/product installers for microsoft suite.
I want to use QT Jambi for GUI (Java project). The GUI needs to have animations (similar to Iphone apps). That is why, I do not want to use Java Swing.
My question is, after I develop the application, is there any automatic mechanism which would create a setup file which could be used to install my application in any computer (may be separate "setup" files for separate OS). In other words, I would like my users to download just one file: setup.exe. This should install the app in their computer.
I know there is one such app for .jar files (I forgot the name). But QT is a C++ library and I do not like bothering the users, asking them to download QT just to use my app.
I presume you are tagetting win32 only on the desktop and looking for free/open tools. With no response to this questio so far I thought I'd provide some info towards this point even if it is not the answer you really want.
I have been looking over the QtJambi ecosphere for the past couple of years and I'm not aware of such a tool to provide you with a process to follow that results in an EXE. There are all kinds of caveats.
The task:
Ensure the JRE5+ is installed on target system.
Ensure QtJambi files and perform things like extraction of native JAR.
Ensure QtJambi pre-reqs are installed on the target system (such as MSVCxxxx runtimes).
Finally install your application and fixup the startup configuration to make use of information above.
Setup desktop fo reasy access (Program Group, Desktop Icon, Menu items, Shortcuts)
You will find that NSIS http://nsis.sourceforge.net/ can be a tool to get some parts of the process and maybe provide a framework to write modules for NSIS that do other parts of the work. But I have found NSIS somewhat lacking when you step outside of a simple unzip of data and setup of desktop install process.
Another solution for you would be to simply provide everything that works in one ZIP file, this would include a copy of the Java JRE embedded, a copy of QtJambi embedded, the rest of your JAR and then write a toplevel *.BAT file to setup %PATH% and other arguments to run your supplied java.exe against your application. Obviously now the JRE is not likely to get updated so at some point will be considered insecure.
NSIS isn't the only such windows installer that exist.
Maybe there is a fully automatic one click install wrapper with custom parts to help setting up QtJambi, but I doubt it at this time.
Good question, and one good attempt at an answer.
I've gone down a slightly different route: embed the Qt Jambi libraries, but not a JRE. I have some basic sh/bat launch scripts which configure the resources required and am using IzPack for the installer (though NSIS might be a good alternative).
Problem: how to find the JRE
Solution: the IzPack installer needs a JRE to run, so guarantees the availability of one. It can update a variable in scripts during installation.
Solution (Windows): use the registry
Last resort: use the path
The ideal would be to integrate all three into a batch file. Anyone done this?
Problem: Qt & Qt Jambi libraries
Solution: distribute with your application and link from the shell/batch file.
The problem with this is how to make sure your libraries get used when binary-incompatible Qt libraries are already installed on the system. On Linux, extracting the libraries and exporting LD_LIBRARY_PATH seems to work. On Windows I haven't solved this and on the Mac I haven't tried.
Problem: most appropriate Qt libraries
32-bit Qt libraries probably won't work with a 64-bit JRE; this is a problem I haven't yet had to deal with. Probably the best solution would be to include both 32-bit and 64-bit Qt libraries and select between them from a script at run-time (or possibly install-time).
Another issue is related to themes: Qt has support for using native themes, but only from the platforms it's compiled on. Thus, compiling Qt on an old Windows version and using the libraries on a modern version of Windows seems to work but results in ugly Windows-98-esque widgets. The easiest solution seems to be to launch with -style Plastique (or cleanlooks) to get nicer-looking widgets.
I made an executable jar, exporting my project with eclipse.
Its working on my laptop but in another one, it doesn't work. I think because xuggler is not installed on that one.Is there any way to get my software working in others laptops? Maybe I should make the executable file in another way.
Thanks for your time and suggestions.
As of 5.3 (which will be released next week) Xuggler can run on most common operating systems WITHOUT an installer. You will need to include the contents of xuggle-xuggler.jar in your program, but that should be it. Enjoy.
As seen on the xuggler homepage you'll have to install xuggler on every machine you intent to use your program.
Therefore you won't be able to make an independent executable jar.
One solution would be to ship the xuggler install with your program and ask the user if he would install it in order to run your program.
I made a little minesweeper game and I want to send it to a friend so he can test it out. The problem(probably) is that he isn't able to run it because he doesn't have Java for programmers(JDK) installed on his computer. How is it possible to export a program that will work on other computers without having to download any other files**(other than JRE)**?
EDIT: I did read about converting the JAR to EXE but I couldn't find anything that would do it.
EDIT2: Download here the JAR file(it's only supposed to open a blank window). I tested it on two computers with JDK installed and it worked, whilst on two others without JDK(one with the newest JRE) it couldn't start. This is the error:
.
There is no way to "not have to download any other files" - your friend must minimally have some Java Runtime Environment (or just "Java") installed in order to run Java programs.
If your friend has Java installed, you can package your application as a fat JAR so that he only needs your JAR to run your application (depending on the application - but I think yours should be fine).
There are tools available, google "java windows executable" and you will find e.g.
Convert Java to EXE
http://jsmooth.sourceforge.net/
Or already on SO
How can I create a Windows .exe (standalone executable) using Java/Eclipse?
Java Web Start is ideal for this, as it can enable the user to install required components on supported platforms. There's a simple example here.
Not possible, a JRE (Java Runtime Environment) is the least that must be present.
If that is you can just export your program as jar specifying the main class in its manifest. Your friend should if a JRE is installed be able to run the jar file directly.
You could send your friend the compiled binary of your game. In that scenario, your friend will only need to have the Java Runtime Environment installed in order to play your game.
Make executable JAR from it, your friend will still need JRE.