I'm trying to send a copy of a GUI game I made to my friends, but they are getting the error: No Java Runtime Environment Found.
I'm using Jar2Exe to turn the jar into an exe.
I found this solution online, but I don't know where to start.
"If you want your software can run on a pc without JRE "installed", you can select to copy a 'jre' along with your program and pack them into install file together."
How can I bundle a jre with it? I don't want this to be an install file, I just want it to run off an exe.
im a little confused here, i think all computers must have installed JRE, because java is used with so many aplications, for example if you could achieve to bubdle JRE inside your game ( jar file ), what happens if your JRE is for windows, and your friend want to play in MAC OS X, or GNU/LINUX?
if you made you game should work in each OS, obvioulsy the require JRE for their respective OS, but if you are getting an error then os not problem of JRE, but your game...
Related
I have installed Netbeans 8.2 and jdk and jre 1.8.0_171. (Windows 10 OS; on a clean installation of the OS btw, just to eliminate possibility of corrupted registry keys, viruses etc).
I believe I have correctly set the system environment etc.
I created a HelloWorld file in notepad; compiled on cmd line, then when tried to run the file, I was asked as to what (default) program I wanted to use to run it.
When I went to associate netBeans I was unable to do so because it does not appear either in the menu, or in the control panel file association facility.
Even more odd, is when I went to check the registry,
Computer\HKEY_CLASSES_ROOT\Applications
netbeans was not there.....
Netbeans itself btw runs and works absolutely fine, so I am rather baffled by this....
Please advise
If you are running a Java application from the command line in Windows then you should be using java.exe to run it. NetBeans is an IDE, and while it does provide functionality to allow Java to be run internally (i.e From within NetBeans), that is very different to using NetBeans directly to run a Java application.
Furthermore, NetBeans does not use the Windows Registry for application registration, which is why you cannot associate NetBeans with any file type. Just because NetBeans can be installed as a Windows application does not mean that it is required to implement all the possible functionality of a Windows Application, such as file association.
It's also worth noting that the beta release of NetBeans 9 is only provided as a zip file, and its installation consists of nothing more than unzipping the dowloaded file to a folder, so it definitely does not use the Windows Registry.
Is it possible to bundle a JRE within an exported stand alone Java app? We have a very specific requirement to run a standalone AnyLogic Java app on a machine that does not have the latest Java version installed and due to company IT policies we will not be able to do so
Through some research I have found some sites to claim that they have already been doing it for Windows and Mac.
Using a bundled JRE on OSX
https://wiki.openjdk.java.net/display/MacOSXPort/How+to+embed+a+.jre+bundle+in+your+Mac+app
http://www.intransitione.com/blog/take-java-to-app-store/
My issue is that most of these posts refer to bundling an app for Mac OS x and requires that the jar files be created in an IDE like Eclipse. But since I use AnyLogic the jar files gets exported without myself being able to intervene. What I need is to change the command line code that runs the jar files and currently looks like this:
java -Xdock:name="AnyLogic Model" -Dnativewindow.awt.nohidpi=true -cp com.anylogic.engine.jar:com.anylogic.engine.nl.jar:lib/database/querydsl/querydsl-sql-codegen-3.6.3.jar -Xmx256m model6.Simulation $*
(Note: Code reduced for readability)
into something that I assume will pass the jre or JVM to be used as an argument to the java call. Or maybe set the directory to be used for java or something... as calling the java command on a machine without java installed renders nothing.
I have a very simple app, as well as a jdk plugin that I got from the moneydance app, which is a java app that runs on OSx with its own embedded jre, available here
https://www.dropbox.com/sh/1bedimsb0lj403t/AADYR7iFoBD4YiqS_RGZ2xAVa?dl=0
Thanks
A colleague of mine who is not on Stack Exchange gave me the answer so here goes, actually quite easy:
In order to meet my specific circumstances one just needs to include a jre inside the root of the folder that you supply to a client and then reference the the java executable in the execution file. The solution for Windows and Mac are slightly different so here goes:
On Mac
You can find the jre in the following folder. It is a hidden folder so if you Mac is not set to show hidded folders go to finder use command-shift-g and go to
/Library/Java/JavaVirtualMachines/
there should be a jdk folder and then navigate to
jdk1.8.0_45.jdk/Contents/Home/jre
On Windows
The location of the jre is in
c:\Program Files\Java\
you can see the location in the .bat file that AnyLogic creates automatically in line of code that looks like this:
#SET PATH_XJAL="%DISK_XJAL%\Program Files\Java\jre6\bin\java.exe"
Once you have the jre copy this folder to the same location as the stand alone java app. Then the only thing that remains is to change the referenced location in both mac command line executable and the windows.bat file
On Mac
Change from
java -Xdock:name="AnyLogic Model"
to
./jre/bin/java -Xdock:name="AnyLogic Model"
On Windows
Change from
#SET PATH_XJAL="%DISK_XJAL%\Program Files\Java\jre6\bin\java.exe"
to
#SET PATH_XJAL= \jre6\bin\java.exe"
Running the java app on both Mac and Windows will now be independent from the Java version on the machine or whether it is installed or not
another alternative is to compile your compiled application into an executable using Exe4J. It is not free but another advantage is that you send your client only a single exe-file, not a bunch of files. (Disclaimer: not tried with the internal AL7-dbase yet but it works fine when accessing external data).
i am currently developing an application on my Windows laptop however I also need it to run on a Mac. Is there a way to either convert my project to .dmg or .app or create a mac build striaght from Windows Eclipse?
I would very much rather not have to install Eclipse on the Mac machine just for this as it is a one time thing. Any Suggestions?
In my experiences you need a Mac to create anything for the Mac/iOS platform. So I guess you need a mac to create a dmg file.
Here is a post that says how this can be accomplished.
Of course you can just run the jar from the command line.
run on any Java virtual machine. It does not matter if you run it on a mac or pc, that's the whole idea with java
Any simple way of creating a dmg file will probably require a Mac, however you don't need to do that; after all, you don't create an exe when you run a Java program on Windows either. Instead export it as a jar file and it should work on both systems (provided a Java Runtime Environment is installed and is set to run jar filed).
If you insist on creating a dmg, check this question which discusses creating them on Windows.
I created an installer that works fine on OS X and Windows. On Ubuntu I get the message "The file '/media/administrator/UNTITLED/installer.jar' is not marked as executable" when trying to right click and launch with Java.
It works after I set the executable bit, but that's not the experience I expect from an installer.
The installer was built on OS X and I also tried to preset the executable bit via ant chmod, but I assume that This is lost or prevented on Ubuntu for security reasons?
Is there a way to reliably preset the executable bit?
If not, are there alternative tools for creating double-clickable Installers that work on Ubuntu without users having to manually set permissions?
Seems the answer is "It's not possible. You need to create a .deb package to get the desired behaviour".
Right click on the file and go properties, then select permissions and check "Allow executing file as program".
EDIT:
Or alternatively, set the jdk/jre as default program for .jar type. (this is one thing you can not control by your installer)
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.