How to recognize Java in CMD [closed] - java

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed last month.
Improve this question
After installing Java Corretto 17 from Java 8, java-version is not recognized in CMD. Prior java projects are not compiling in my IDE.
I uninstalled prior JDK 8 and installed Corretto. I updated the path in my system and environmental variables, but to no avail. I am able to update each project individually with the Corretto in my IDE's project structure. I'm looking for a system wide solution.

You need to follow the instructions here - https://docs.aws.amazon.com/corretto/latest/corretto-17-ug/windows-7-install.html
Specifically step 4:
Once the install wizard is finished, set the JAVA_HOME and PATH
environment variables.
Set JAVA_HOME to the installation location, noting that the directory
contains the currently-installed version. For example, if the default
directory is used for 17.0.0, then set JAVA_HOME as C:\Program
Files\Amazon Corretto\jdk17.0.0_35.
Add %JAVA_HOME%\bin to the current PATH variable.
Based on the symptoms you reported, it seems that you did not set PATH correctly ...
I'm looking for a system wide solution.
Make sure that you set the "system" versions of the variables. But if there are user / account specific overrides for PATH and JAVA_HOME they will need to be updated also. Note that you may need to restart your CMD shell to pick up changes that you made to environment variables via the GUI. That's just the way that environment variables work ...

Related

How to properly build native executable file from jar? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I have had Intellij IDEA generate an executable jar for me and executing the jar using java -jar command works great.
But when I try to wrap this jar into an exe file using launch4j, various errors happen. First there was an error saying "Could not find or load main class".
After looking at this and this questions I thought the problem is about pathnames or classnames. However, that was not the case. Apparently, the main class was found, but couldn't be loaded because there was no pathnames to Java and JavaFX runtimes.
After adding rt.jar and jfxrt.jar to classpaths another error appeared:
"JavaFX runtime components are missing, and are required to run this application"
And now I really don't know what to do. I downloaded the latest jre (8.0.221) but nothing changed. jfxrt.jar is a JavaFX runtime to my knowledge, but it seems like the application doesn't recognize it as one.
Any recommendations for deploying, suggestions for my project or remarks are welcome and appreciated. Thanks!
I achieved what I wanted by using one of launch4j built-in functions. In section JRE there is an option for bundled jre path. And to create native app launcher with bundled jre you just have to specify the path of jre. This took me 5 days to find.
You can make .exe file using Inno tool set up.
I have used this there was no error, exe runs fine.
Link :- http://www.jrsoftware.org/ishelp/

Do I really need to set JAVA_HOME path in MAC to start coding simple programs using eclipse

I am newbie to MAC platform.
I need to know if I really need to set JAVA_HOME path on MAC OS.
Previously I have used windows and from what I have learned is, user need to specify JAVA_HOME path in "Environmental Variables" so that the system will know if JAVA is really installed in computer.
But is such thing not mandatory to do in MAC?. Can I code right away after java installation?
Can someone explain
NO,
you don't have to set JAVA_HOME path to run java code in eclipse. Though to run the code you will have to set the Run configuration, and specify the JRE you want to be used, to run the code (under JRE tab of Run Configuration). Here you will browse and point your system to access the required (Installed) JRE.
Though if you set JAVA_HOME path, you would be able to call the compile and run for java code from command line (Terminal) as well. and Eclipse will also pick the same without setting it up explicitly.
You can code right away; the eclipse oomph installer will hardcode a link to the location of your java vm for you in eclipse's config, which means eclipse will start regardless of your PATH or JAVA_HOME variables.
When running java apps from within eclipse, eclipse has its own registration of where java vms live. You can install various versions of java; you can tell eclipse about any or all of them and pick the VM that goes with a given project (the default is in windows | preferences, search for 'jre' in the filter – and you can also override this default in the project; right click on a project and select properties).
Any attempt to run stuff within the project will use the project's configured VM, and if there isn't one, the default as configured in the window|preferences dialog.

How to instruct Maven to use JDK other than the one specified at JAVA_HOME?

Currently my JAVA_HOME is set to a JDK that is 1.4.2.
To run Maven 3, I would need 1.5 and above.
Is there any way to instruct my Maven installation to use another JDK that is installed other than changing the JAVA_HOME environment variable?
That's pretty much the way to do it. I assume you mean you don't want to change your global JAVA_HOME. That's fine. You just need to set a different JAVA_HOME for Maven. You can easily do that by creating a file at /etc/mavenrc or ~/.mavenrc (Linux) or %HOME%\mavenrc_pre.bat (Windows) with the appropriate JAVA_HOME defined in it. Maven executes those on startup if they exist unless you've defined a variable named MAVEN_SKIP_RC. You could also modify the Maven startup scripts directly, but there's no good reason for that since it gives you these nice hooks.
On Windows:
STEP 1:
Find apache-maven-3.2.1\bin\mvn.bat, then find and replace JAVA_HOME to JAVA_HOME_MVN.
Note: Before this, make a backup of mvn.bat
STEP 2:
Create a new environment variable called JAVA_HOME_MVN and point it to the bin of whichever jdk you want to use.

java name of folder in which java is installed

Hi is there a chance to find where is java installed on windows ?? Becouse my application use JCE but not all algoritms are installed and I have to download some files
like its writen here.
Edit:
Another question, how to check if JCE is istall and contains such algotitm (DES) ??
It is typically installed under c:\Program Files\Java\{JRE Release)
Otherwise you can find the JDK home if it is installed by the JAVA_HOME environment variable.
Somewhere around C:\Program Files\Java\jre6.
Depending on your system privileges, you may be able to look at your environment variables. From what I understand, the bin folder of your JRE installation should be included in your PATH variable.
You can print this out by typing path into a command line ,
or you can find it by right clicking on my computer, and going to properties. Under the Advanced tab, you should see an environment variables button, and your PATH will be in the bottom list.

Installing Java in Win7 64bit

I have a new laptop and attempted to install jdk-1_5_0_22-windows-amd64, jdk-1_5_0_22-windows-i586-p and jdk-6u22-windows-i586 without success.
I have used java before and I am familiar with environment variables.
However I cannot get the java version at command prompt or the java compiler to work.
Also I am using Blackberry JDE and it does not find the installed version to build.
Can anyone help me?
Add the path to the Java bin folder to your PATH environment variable.
In order to run any java from the command line, the bin folder of the java installation must be added to the PATH environment variable. Without this, the command prompt cannot find your java installation, so it cannot run your files. Make sure to open a new copy of the command line after you set the environment variable.
Right click on My Computer and choose Properties. Choose the Advanced tab, and then the Environment Variables button. There should be a "Path" under system variables. Add a semicolon to the end and add the path to your installation's bin folder after that.
I would imagine that the Blackberry JDE makes use of the JAVA_HOME variable. I am guessing that it is not set so the JDE doesnt know where to look on the file system.
I think that Erick is correct in verifying that the bin directory has been added to the PATH. If you used the installer, you might need to reboot your machine.
Finally, the JDE appears to be a slightly aged package. I cannot seem to find the statement saying that the Blackberry JDE supports 64 bit java.

Categories