I am trying to package a jar file into an executable file using the jpackage tool in Java, but the command is not recognized in the command prompt using Windows 10 and Java version:
> java --version
java 17.0.1 2021-10-19 LTS
Java(TM) SE Runtime Environment (build 17.0.1+12-LTS-39)
Java HotSpot(TM) 64-Bit Server VM (build 17.0.1+12-LTS-39, mixed mode, sharing)
I have the full JDK installed and the command javac is recognized.
I checked my computer with the "where java javac jpackage" command and it only found the first two in the CommonFiles folder.
I looked in the folder path "ProgramFiles\Java\jdk-17.0.1\jmods" and both the "jdk.jlink.jmod" and "jdk.jpackage.jmod" files are present.
Can someone please help me figure out why the tool isn't recognized by Windows?
I found the issue to be the way my Environment Variables were set up for Java. To fix my problem, I went into the JAVA_HOME variable and changed the entry from
C:\ProgramFiles\Java\jdk-17.0.1\lib
to
C:\ProgramFiles\Java\jdk-17.0.1
Next I updated the path variable to include "%JAVA_HOME%\bin". Before I had it listed as C:\ProgramFiles\Java\jdk-17.0.1\bin. Both of these changes were made under the System variables using the "Edit" button. I want to thank dave_thompson_085 for pointing me in the right direction.
Related
its showing below details while checking 'java -version' in CMD
java version "11.0.15" 2022-04-19 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.15+8-LTS-149)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.15+8-LTS-149, mixed mode)
I am getting below response in Eclipse while using 'System.getProperty("java.version")'
Java Version is: 17.0.2
The CMD uses the PATH environment variable to search for executables (java.exe). The executable is searched in the directories listed in that variable, in the given order. The first one found, is the one that is executed.
Eclipse uses its own settings:
the JRE used to start Eclipse can be specified in the eclipse.ini file; if not specified there, the OS default will be used (usually the same as the CMD, see above);
the JRE used to execute an application inside Eclipse, is specified by the Run/Debug configurations (Run-Run Configurations.../Run-Debug Configurations...), the respective project properties (Project-Properties) and Eclipse preferences (Window-Preferences-Java-Installed JREs).
When I chose "Use Default Workspace JRE" inside Java Build Path->JRE System Library it is showing Java 11.0.15 in eclipse
I had Java SE (version 8) installed on my computer (Windows 10). Now, I have downloaded version 13. I have also added the path
C:\Program Files\Java\jdk-13.0.1\bin
in Environment Variables -> System Variables -> Path
But still when I write
java -version
on cmd, I get the path of the older version.
java version "1.8.0_231"
Java(TM) SE Runtime Environment (build 1.8.0_231-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.231-b11, mixed mode)
Upon writing
where java
I got the following result
C:\Program Files (x86)\Common Files\Oracle\Java\javapath\java.exe
C:\ProgramData\Oracle\Java\javapath\java.exe
C:\Program Files\Java\jdk-13.0.1\bin\java.exe
In the environment variables ->
I get the following relevant paths:
C:\ProgramData\Oracle\Java\javapath
C:\Program Files\Java\jdk-13.0.1\bin
Note: doesn't have the path of Java 8 as I deleted it.
Interestingly, I am still able to run the Java code.
I am confused now..
Move C:\Program Files\Java\jdk-13.0.1\bin to the top in the list of environment variables. Then, open a new command prompt and execute java -version.
If you don’t explicitly add the directory to your PATH environment variable, you get the java binary installed at system level.
This was typically done by the browser java plugin installer, which is not used anymore so you get to keep the old version. I would suggest uninstalling it.
I've always used Google2SRT, a light software to download subtitles from Youtube. Now it no longer works: "Startup Error: Failed to find Java VM".
I have Java installed, I have Netbeans installed and working, I have never had any Java related issues.
I've tried reinstalling everything, I've tried creating a JAVA_HOME and JRE_HOME System variable and pointing it to "C:\Program Files\Java\jre1.8.0_191" according to this tutorial: https://confluence.atlassian.com/doc/setting-the-java_home-variable-in-windows-8895.html
It felt odd because I didn't even had this environment variable previously. I have no idea what's the issue.
I've tried uninstalling Netbeans and other programming tools as well.
I'm on Windows 7 x64.
java -debug -version > "%userprofile%\desktop\javaDebug.log" 2>&1 returns:
java version "1.8.0_191"
Java(TM) SE Runtime Environment (build 1.8.0_191-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.191-b12, mixed mode)
I have also tried setting maximum heap size in _JAVA_OPTIONS
System Variables
Just go to the install dir (e.g. C:\Program Files (x86)\Google2SRT), open a cmd.exe, cd to the above folder and type java -jar Google2SRT.jar. You don't need the .exe
This should work, provided you have java installed. Check by typing java -version in the cmd.
Recently I copied Netbeans 8.2 to new computer and unfortunately the java path are different from previous. My machine running on Windows 10 x64. And when I running netbeans64.exe on bin folder than two popups appear
cannot locate java installation in specified jdkhome:C:\Users\root\Workspace\root\idk\java\jdk\1.8\bin\
After that, I choose to use default version, than another popup appear
cannot find java 1.8 or higher
I've follow instruction to change on /etc/netbeans.conf as below
netbeans_jdkhome="C:\Users\root\Workspace\root\idk\java\jdk\1.8\bin\"
But it doesn't works. I can assuring you that inside the folder contains java.exe which is version 1.8
java version "1.8.0_152"
Java(TM) SE Runtime Environment (build 1.8.0_152-b16)
Java HotSpot(TM) 64-Bit Server VM (build 25.152-b16, mixed mode)
I had registered that path above on System Environment Variables
I have tried to use parameter --jdkhome but still got the same result.
What wrong with my Netbeans? Any other suggestion?
Thanks
jdkhome should point to the root of the JDK folder, not the bin folder inside it.
So it should be:
netbeans_jdkhome="C:\Users\root\Workspace\root\idk\java\jdk\1.8\"
or
--jdkhome C:\Users\root\Workspace\root\idk\java\jdk\1.8
Hello guys this is the first time i write a question here and not just read an answer.
My problem is that I have a Macbook with Sierra on it and hava a tomcat with my wsdl file and i wanted to generate my classes with axis2 so i started the wsdl2java.sh in Eclipse and till that point everything works fine.
But then it says:
You must set the JAVA_HOME variable before running Axis2 Script.
but when i open a terminal and lookup for
echo $JAVA_HOME it will say:
/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home
and also when i type in java -version i get this result:
java version "1.8.0_101" Java(TM) SE Runtime Environment (build
1.8.0_101-b13) Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)
my question is why does eclipse not found my JAVA_HOME path?
i allready started eclipse as sudo directly through the terminal and also tried to change the .bash_profile but nothing works for me
I hope i described the Problem so that you can help me !
thanks a lot
As Minh Kieu recommended in the comments, I added this to the shell script of wsdl2java:
export JAVA_HOME=$(/usr/libexec/java_home)
Then I restarted Eclipse and now it worked.