I am trying to embed (internalize) java into the installation directory of my application. Looking at the documentation and all other help available that I could go through I copied the java directory to the application one and then set all the environment variables and paths as prescribed. However, when I launch the application using this new java directory it gives java not found error. Can someone give me some tips?
Thanks in Advance!
However, when I launch the application using this new java directory it gives java not found error. Can someone give me some tips?
You've obviously not set up the %PATH% environment correctly. That's what is causing whatever is launching Java to say "java not found".
You could:
modify whatever is trying launching Java to print out the environment variables, or
change whatever is trying launching Java to use the absolute pathname for the "java" command.
I wish you good luck in this task but may I ask you why do you want to do this? If you really wish to put java under your application install java there. You can use silent mode of installation. I do not remember the syntax right now but if you are on windows, java is installed by Windows installer, so search for "run windows installer silently" and follow the instructions. I believe that this approach will work on better and easier.
Download the source to WinRun4J (alternative to javaw on windows) and see how they initialize the JVM.
Related
I have a java application that consists of various files and I need to run my project. I have jdk 14 installed and have also set the Environment Variables. But when I click on Launch project, it just keeps loading and loading and nothing else happens. It does not show me any error log or anything. I am really confused and been trying to solve this for a week. In launch, it does not give me any option of java. It says Launch in angular. Any help would be appreciated?
VS Code is basically an editor for sourcecode files of different languages. As such, it does have any inbuilt Java execution options.
To debug your Java programs, you will need to install the appropriate Java extensions for VS Code.
Having Jdk installed is a prerequisite to use Java on VS Code but it alone is not enough.
this is a kind of weird non programming (but java related) question.
I created a java program (game) using just normal java, and no libraries.
In ordor to double click/open it, you need to have java SDK/JDK (I don't know which) installed.
I tested this multiple times, and in order for my PC and Mac to launch it, you need to install it.
is there anyway to get around this? I know Minecraft doesn't force you to download the JDK.
Here's the link to source code of my game if your interested (no, it is not a virus): http://www.filedropper.com/daplatform
Thanks, Jake
Here's the link to the download of the JDK (Its next to the giant Netbeans download): http://www.oracle.com/technetwork/java/javase/downloads/index.html
What you can do is you can wrap both your program and the JRE required to run it into a single executable for the target platform.
For example your windows installer would include both a windows JRE and your program itself.
Launch4j http://launch4j.sourceforge.net/ lets you wrap a Java program into a windows executable and gives you options about how to handle the JRE, including bundling it.
I made java application's setup file through install4j and it is well known that netbeans application does not run without jre. so my question is that is there any way to install jre automatically if it is not installed previously before installing application.I heard that there is way to create .dll or .bat file for that but i dont know exact about that.So please help me as soon as possible.
Thanks and Regards,
Mahesh
http://www.ikvm.net/
This might be a good route to go, i'm looking into it now. In short it pushes your jar to run on a .net build
I have a friend without java. I want to package my executable .jar file with java platform SE binary in an exe file so he can run it without downloading the entire java runtime. Could someone point out some kind of software that does that?
I have a friend without java.
And you call them a friend? ;)
Use deployJava.js to check the user has the minimum Java required to run the app.
Install & launch the app. using Java Web Start.
Give the user a link to the 'launch' web page.
This will work on Windows ..and OS X ..& *nix.
Try using Launch4J at http://launch4j.sourceforge.net/
Here's the highlights:
Launch4j wraps jars in Windows native executables and allows to run them like a regular Windows program. It's possible to wrap applications on Windows, Linux, Mac OS X and Solaris!
Also creates launchers for jars and class files without wrapping.
I have also had good experiences with Launch4j. Also check out JSmooth: (http://jsmooth.sourceforge.net/index.php) which claims to have an option to download and install a JVM if one is not available.
I've got a curious problem. After installing java jdk 6u25 I tested the installation by typing java in the command prompt. Everything worked fine , the console displayed the usage options as expected. This was about 3 weeks ago - I recently reinstalled windows 7 on my machine- Now I would like to get started with the play framework and followed a tutorial. I got a new application with play new but couldn't use play run because of this:
play! 1.2.3, http://www.playframework.org
Ctrl+C to stop
Could not execute the java executable, please make sure the JAVA_HOME environment variable is set properly .
The funny thing is that typing java in the console still displays usage options and neither eclipse or netbeans complained about a missing jdk. Nevertheless I checked my environment variables and was surprised to find:
No reference to java at all.
Seriously I got no idea how the console, eclipse and netbeans found my java. As a first countermeasure I once again reinstalled java hoping that the installer might set the path correctly. It didn't. Now I would like your advise: Should I just create the JAVA_HOME variable ? If I do, will further versions of the jdk override the variable to point to the new version or will I have to change the variable manually everytime? What about eclipse and netbeans. I would guess that they have been downloaded with their "own" jdk. If I want to update java on my machine, will it update their versions, too ?
Update:
I set the environment variable manually and restarted the pc. Now everything works fine but I would like to know what symbolic link is. Could you just give me a link in a comment or explain briefly ?
Eclipse and netbeans use a different way of finding your java installation than command line tools likes play, ant, maven, gradle etc.
IDEs may search your registry, guess default locations, or even have the JRE prepackaged with the installation.
Command-line tools usually rely on JAVA_HOME variable. And you have to set that manually.
Should I just create the JAVA_HOME variable ?
There are several tools that use that environment variable, so I'd recommend creating it.
If I do, will further versions of the jdk override the variable to point to the new version or will I have to change the variable manually everytime?
If you install your new Java version into the same folder (or if you create symbolic links), then no.
What about eclipse and netbeans. I would guess that they have been downloaded with their "own" jdk. If I want to update java on my machine, will it update their versions, too ?
That depends on whether the JDK is prebundled and how the configuration is done. I can't speak for Netbeans but in Eclipse, you could add this to your eclipse.ini:
-vm
C:/Java/jre/bin
Note that this is an example path to the bin folder. If you don't add versions there or use symbolic links (see above) then you'd not have to update the path when installing a new version.
It is possible that you have a (older?) java.exe in C:\windows or other common directory.
Make sure that the java you get on the command line is the one you think it is:
java -version