#If I want to send a program to my friend, does he need Java to run in?

1 messages ยท Page 1 of 1 (latest)

boreal elmBOT
#

<@&987246399047479336> please have a look, thanks.

#

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>.

#
TJ-Bot
And is there a way to make a program run without Java?

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.

normal shadow
#

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.

ornate tide
#

It is an installer for your program

#

And it contains java

wheat depot
#

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

ember fox
#

The 3rd is graalvm, with native-image

wheat depot
#

which can work, but has some asterisks

#

not all java code will run with it

ember fox
#

yeah, I'm experiencing that firsthand

wheat depot
#

minecraft installs java with it

#

and that java install is just for minecraft

trim ember
#

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

wheat depot
#

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:

trim ember
#

Hence why I said that

wheat depot
#
  1. Are you using maven or gradle. if so which one
  2. What are your dependencies
  3. are all your classes in "packages"
  4. What editor are you using
  5. What operating system do you have and what os does your friend have
nimble canyon
#

thats what Launch4J does, yes

trim ember
wheat depot
#

but i'm on mac - that might change things

#

either way, the "like 2 minutes of medium-quality video" comparison stands

trim ember
#

Hmm
Ah I might have compared to compressed form my bad

ornate tide
#

No my 8mb jar when bundled with java is like 59mb, so jre is ~50mb

#

Java 17 tho

ember fox
#

--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)

undone crypt
#

they reduce jre size a lot

#

with only java.base I get 26 MB for JDK 17