#If I want to send a program to my friend, does he need Java to run in?
1 messages ยท Page 1 of 1 (latest)
Here is an AI assisted attempt to answer your question ๐ค. Maybe it helps! In any case, a human is on the way ๐. To continue talking to the AI, you can use </chatgpt:1108714622413963314>.
Yes, in order to run a Java program, your friend will need to have Java installed on their computer. Java is a programming language that requires the Java Virtual Machine (JVM) to execute code. Without Java, the program will not be able to run.
There are ways to package a Java program so that it can be run without the need for the user to have Java installed. One common method is by using a tool like JAR (Java Archive) files, which bundle the Java program along with its dependencies into a single executable file. This allows users to run the program without needing to separately install Java.
Another option is using native image generation tools like GraalVM, which can compile Java programs into standalone native executables that do not require the JVM to run. However, this approach may have limitations and may not work for all types of Java programs.
Overall, while it is possible to make a Java program runnable without requiring Java installation on the user's computer, it may involve additional steps and considerations. It is important to assess the specific requirements of your program and your friend's environment before deciding on the best approach.
They will need java to run it. You can used tools like jpackage to build and send them an .exe, but that exe will simple contain java and your program.
Yes and no
No they can't run it without java
Yes you can give them Java with your app
There are two ways to do that which "just work"
The first is jpackage, which comes with java
The 2nd is launch4j, which is its own thing you can download
The 3rd is graalvm, with native-image
yeah, I'm experiencing that firsthand
It is heavy
It's like 50mb
But compared to a big application, that's nothing
For a video, 50mb is small yes
But for that, it's not small
so the maximum size jdk, with everything, is ~300mb
give or take
we can trim that down a bit depending on you program
so
can you describe your program + answer these questions:
Just the jre part is 50mb
Hence why I said that
- Are you using maven or gradle. if so which one
- What are your dependencies
- are all your classes in "packages"
- What editor are you using
- What operating system do you have and what os does your friend have
thats what Launch4J does, yes
Actually jdk is around 200mb
And the jre is 50mb
If you manage to get rid of a few things in the jre, you can probably reduce its size to 40mb or 30mb
@fierce knot
I have a problem
but java.se weighs in at 96mb
but i'm on mac - that might change things
either way, the "like 2 minutes of medium-quality video" comparison stands
Hmm
Ah I might have compared to compressed form my bad
--compress 1, that dedups strings and gives you the smallest install
if you compress 2 it will have a zipped file already which doesn't compress as well (or at all)
You forgot to use --strip-debug, --no-header-files and --compress 2
they reduce jre size a lot
with only java.base I get 26 MB for JDK 17