This question already has answers here:
How to increase the java heap size in netbeans?
(3 answers)
Closed 8 years ago.
I am new to Java and I create a project in Java using NetBeans 8.0. Now I
want make a .jar file from my project. But when I click on Clean and
Build option, after few minutes it displays an error like this.
The system is out of resources.
Consult the following stack trace for details.
java.lang.OutOfMemoryError: Java heap space
My project runs perfectly and in working condition it displays the above
error only when I want to clean and build the project. Or guide how to make
a .exe file without a .jar file.
Please help me it makes my life very difficult.
Thank in advance
If you want to make .exe file from .jar file You can use the ExcelsiorJET to convert jar files into native codes. Its a very good software to do it but i will suggest you, use it if you want to publish your software commericailly.
It also provide a high level obfuscation to your codes.
If you want to read about it more Official site of ExcelsiorJET
and about java.lang.OutOfMemoryError:
That means your codes are using more memory(heap space) than default heap size set to JVM. One more thing it also indicates that there may be some memory leaks in your codes so try to patch them also ..
To solve this problem .. you should go to this link Click here
i don't want to repeat all things so visit this link
Related
Theres a game jam coming up that I want to participate in. Java has been what I program games in, so its natural that I would want to use it in this game jam. Problem is, it cannot require other software. And I believe that includes Java. So is there some way to include java within some sort of exe file? Or otherwise include it? Assets dont have to be contained, but the overall size does have to be less than 1GB, so I need enough space for the actual game and assets.
This was answered in this post.
Compiling a java program into an executable
You will need a wrapper for your .jar files.
Lanch4j is one viable option to do this.
Link to software:
http://launch4j.sourceforge.net/
Here is a tutorial on how to use it:
https://www.youtube.com/watch?v=MyMPPuYGN-U&ab_channel=GoXR3PlusStudio
Best of luck with your game jam.
If running on a Linux machine, a way to do this is by using a JVM that supports compiling the Java program to a native executable.
For example, GraalVM offers native-image compilation functionality.
I need to send a project made by JavaFX SDK 16 and Java SE-15 using Eclipse to my friends, but when I try to export it, i'm getting surprised that Eclipse doesn't insert the VM arguments to the exported file :
and as you know since JavaFX SDK 10, JavaFX libraries are not anymore part of the Java SE, so we need to tell Eclipse where to find them by VM arguments, in short words, these VM arguments are really important to run my program.
I already know that I can insert those arguments while using prompt command to open it, but is there a more simple way? just by clicking on the exported file ?
Your main problem is that you are trying to do something that does not make any sense. Runnable jars are not a proper distribution format for JavaFX applications for various technical reasons. The way to go is having a look at jpackage. That's the proper way of dealing with distribution nowadays. Otherwise your are just banging your head against a wall.
Here is a good summary of all the options you have: https://stackoverflow.com/a/68823040/4262407
I have this problem 5 years ago (I use netbeans IDE, so I don't know if it works in eclipse, but I think yes), and I cant find a good way to do this.
Instead, I created one Swing application, and put all code of JavaFX inside.
You could see how I do in
this link from Oracle.
This question already has answers here:
How can I write a Java application that can update itself at runtime?
(9 answers)
Closed 4 years ago.
What a really need is a java application that checks for new updates from an XML or TXT file from the internet which shows the files that have been updated like the following:
V.1.0.5
class1.java
img/img1.jpg
V.1.0.6
class1.java
class3.java
class4.java
The App. Should check Updated from his Current version to the latest and make a list of the updated files, in this case is should be:
class1.java
img/img1.jpg
class3.java
class4.java
The app Should then download this files from a link like : http://webadress.com/appfiles/XXXXXXX where XXXXXXX is the file name.
The main problem i've faced is How Can the app download and replace this files within the Same app JAR file.
i've thinked about a bootstrap (SecondP App that launch the main app and check for updates . but can't really get it to work , As it should Extract the main app jar replace and download the new update files then re-archive the files in one jar file and launch it .
Simply what i really need is an application that can update it self on file by file bases not replacing the whole jar file. as bandwidth is really a huge matter.
Thanks a lot for help in advance :)
You need two separate programs in two separate JVMs: your program and the updater. The updater (possibly on user request) checks what should be downloaded, downloads the files and then warns the user.
The user than saves his work, shuts down the application and tells the updater to patch the application binaries, for example by replacing JARs, updating databases and/or configuration files, symbolic links and whatnot.
I don't know of any framework that can ease the writing of such a system - so likely you'll have to code every piece of code by yourself. Since it's not an easy task, you should consider the conservative alternative of simply writing a wizard (there are frameworks for this) that completely replaces the binaries and works for both first installation and upgrade. Also, consider that sometimes you'll need the updater to upgrade itself!
This question already has answers here:
Directory listener in Java
(3 answers)
Closed 9 years ago.
There are two directories with the same content (local directory and remote directory). sync files do when a change in one of the directories. I check directories continuously via Java and to get information for changes on the directories. But I'm looking for an alternative way.
My question is;
Does linux give informations for changes on a directory?
and if linux gives the information,
How to get the information from Linux continuously via Java, if there is a change in a directory?
Any idea?
Since you're using Java 6 (and therefore cannot use nio to watch a directory), you should take a look at JNotify. It lets you watch directories for file changes. It works in Linux by providing a native library which uses inotify.
This question already has answers here:
Closed 12 years ago.
Possible Duplicate:
How can I convert my java program to an .exe file ?
I've used JSmoothGen in the past, but recently we've seen a number of machines that refuse to run the .exes that it generates. It also seems not to be actively maintained so heavily any more.
Are there any alternatives that are more actively maintained and more reliable?
I use Launch4J which supports Windows, Mac and Linux. I suggest forgoing the somewhat flaky GUI tool and just writing the (short, readable) config file yourself.
The gnu compiler
gcj
I found this article to be very informative http://www.excelsior-usa.com/articles/java-to-exe.html.
Someone already mentioned Launch4j, however, I found Jsmooth to be alittle better. They are both very similar, but I would mess with both to see which you prefer.
EDIT: Sorry, I somehow skimmed over your mention of Jsmooth in your question. If Jsmooth isn't working for you, then I would go for Launch4j. I still recommend that article.
http://sourceforge.net/projects/javaround
HTH
It is also not entirely necessary to make an .exe. On Windows, at least, .jar files are executable so long as there is a Java runtime installed and the .jar extension has been set up on the machine.
[NOTE: I just discovered that something that has broken the file association, which had previously worked for me. It now only works when I am administrator, and the JAR icon even disappears otherwise. I assume that some recent install has messed with that and the candidates are (1) OpenOffice.org 3.0, (2) WinRAR, or (3) a Java update download. However, the following all work when the association is made to work.]
The "program" Clicker.jar runs as a Java application when (1) I double-click on it in a Windows Explorer window, (2) When I create a console shell where I am in the same directory and I perform the command ">Clicker.jar" (3) when I send a shortcut to my desktop and double-click on it, and (4) when I put the full path in the Windows XP Run ... box.
I don't know that these will be found in a PATH search, and I normally wouldn't arrange that anyhow.