Izpack installler failing on Windows with java.lang.NullPointerException - java

Updated application to use bundled version of Java 14, was previously using Java 8
Worked okay on Windows dev machine , but on other machine failing on unpacking the data with:
com.izforge.izpack.api.exception.IzPackException: An error occured
in java.lang.Thread.run() at Thread.java:832
in com.izforge.izpack.installer.unpacker.UnpackerBase.run() at UnpackerBase.java:241
in com.izforge.izpack.installer.unpacker.UnpackerBase.unpack() at UnpackerBase.java:319
Caused by: java.lang.NullPointerException: null
in com.izforge.izpack.installer.unpacker.UnpackerBase.unpack() at UnpackerBase.java:299
in com.izforge.izpack.installer.unpacker.UnpackerBase.unpack() at UnpackerBase.java:475
in com.izforge.izpack.installer.unpacker.UnpackerBase.unpack() at UnpackerBase.java:528
in com.izforge.izpack.installer.unpacker.UnpackerBase.unpack() at UnpackerBase.java:627
in com.izforge.izpack.installer.unpacker.UnpackerBase.extract() at UnpackerBase.java:673
in com.izforge.izpack.installer.unpacker.LooseFileUnpacker.unpack() at LooseFileUnpacker.java:92
in java.io.File. () at File.java:362
Can't see why, does it not work reliably with Java 14 ?

There are some difference between jdk. Try to use jdk from:
https://adoptopenjdk.net/
https://www.oracle.com/java/technologies/javase/jdk14-archive-downloads.html
Be sure that you change system path for new jdk, and you use another jdk that earlier.

Does the other machine have java 14 jdk installed?
You can check the following folder on windows:
C:\Program Files\Java
if you do have jdk-14 installed, try running inside the command prompt the following:
"C:\Program Files\Java\YourJdkVersion\bin\java" -jar YourCompiledJar.jar
If the app runs correctly using the command above, it's because of the environment variable.
In that case, do the following:
Right click My Computer and select Properties.
On the Advanced tab, select Environment Variables, and then edit
JAVA_HOME to point to where the JDK software is located, for example,
C:\Program Files\Java\jdk1.6.0_02. (should be something like jdk-14 in your case)
from docs.oracle.com

Related

Java command not recognized by cmd if not run as admin

In windows 10 I installed Java 13 and updated the path variables. One strange thing I see is java command is not recognized until I run cmd as admin. Any idea why this happens? Do I need to change any settings
Seems like you installed java into the folder that can be accessed only by administrator. Thave to installed java on this path C:\WINDOWS\system32; C:\WINDOWS; C:\Program Files\Java\jdk1.8.0\bin
now it will be recongnized by all users.
BTW: for me Java 8 is better choice than Java 13

What makes Oracle SOA Suite 12 JAR unable to recognize the JAVA_HOME?

I am trying to install Oracle SOA Suite 12 on Windows 10. I set the JAVA_HOME correctly (able to echo it), and then trying to run the JAR. It gives me the following message:
This installer must be executed using a Java Development Kit (JDK)
but C:\Program Files\Java\jre1.8.0_161 is not a valid JDK Java Home.
It seems to look for the JRE folder and by default neglecting the JAVA_HOME environment variable. I did a workaround by navigating to the JDK folder, and then running the java.exe inside the JDK folder (java.exe -jar /path/to/soasuite). It works well. I just want to know what might be the reason.
I advise you to set the properties as follow. Adapt correctly to your path in the JAVA_HOME property, and the others will follow.
JAVA_HOME := C:\java\jdk1.8.0_151
JDK_HOME := %JAVA_HOME%
JRE_HOME := %JAVA_HOME%\jre
CLASSPATH := .;%JAVA_HOME%\lib;%JAVA_HOME%\jre\lib
PATH := %JAVA_HOME%\bin;%PATH%
EDIT:
I did a workaround by navigating to the JDK folder, and then running
the java.exe inside the JDK folder (java.exe -jar /path/to/soasuite).
It works well. I just want to know what might be the reason.
This means that you are missing the change in the PATH environment.
I was not able to utilize the path variables described - did not want to restart the machine durng and install of oracle software. I was able to successfully complete the install of weblogic oracle fusion by doing the following.
RUN JAR files using command prompt due to having issues running the java installed setups for oracle12c, weblogic ,etc.
RUN command prompt as adminsitrator:
1. CHANGE DIRECTORY IN COMMAND PROMPT TO:
C:\Program Files\Java\jdk1.8.0_181\bin
RUN the command like this - pointing to the proper JAR file.
java -jar c:\oracleformssoftware\fmw_12.2.1.3.0_infrastructure.jar
This definately worked for me but please note I did finally setup the path variables instructions noted here.

java Chronicle Map - JavacTool java.lang.ClassNotFoundException

Trying to execute myApp based on ChronicleMap API:
java -jar myApp-00.00.01-SNAPSHOT-jar-with-dependencies.jar
and getting exception.
Exception in thread "main" java.lang.AssertionError: java.lang.ClassNotFoundException: com.sun.tools.javac.api.JavacTool
at net.openhft.chronicle.values.CompilerUtils.reset(CompilerUtils.java:62)
at net.openhft.chronicle.values.CompilerUtils.<clinit>(CompilerUtils.java:51)
at net.openhft.chronicle.values.ValueModel.createClass(ValueModel.java:348)
at net.openhft.chronicle.values.ValueModel.createHeapClass(ValueModel.java:327)
at net.openhft.chronicle.values.ValueModel.heapClass(ValueModel.java:317)
at net.openhft.chronicle.values.Values.heapClassFor(Values.java:68)
at net.openhft.chronicle.values.Values.newHeapInstance(Values.java:37)
at com.twi.lib.ev.ipc.VTORId.<clinit>(VTORId.java:189)
at com.twi.lib.ev.ipc.Ipc.initialize(Ipc.java:294)
at com.twi.lib.ev.base.Preferences.areRequiredPreferencesSet(Preferences.java:356)
at com.twi.lib.ev.base.ApiEv.autoinitialize(ApiEv.java:48)
at com.twi.demo.ev_examples.Main.main(Main.java:116)
Caused by: java.lang.ClassNotFoundException: com.sun.tools.javac.api.JavacTool
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at net.openhft.chronicle.values.CompilerUtils.reset(CompilerUtils.java:58)
... 11 more
Here is my config:
OS Installed: Windows 10
Java Installed: JDK 1.8.0_131
Java Path: C:\Program Files\Java\jre1.8.0_131\bin\javaw.exe
ChronicleMaps tested: 3.10 - 3.13 - same problem for all these versions
MyApp runs fine under Netbeans 8.2 but this exception always comes up if trying to run in command window and command:
java -jar myApp-00.00.01-SNAPSHOT-jar-with-dependencies.jar
What is wrong?
Missing jar library JavacTool ?
Compatibility?
Bug in ChronicleMap?
Thank you for any input for getting myApp running with command:
java -jar myApp.jar
Got it working. Here is how in case someone else struggles with Windows and java configuration.
If you want to run your jar application (with the ChronicleMap API) the standard java way - e.g:
java -jar myApp.jar
you must make sure your executing "java" is the JDK java and not JRE java.
This means you and your app. users will need to have JDK installed on your system
and configured so that the JDK java is used, not the JRE java.
That's been clear to me from beginning, and I thought my system was running
JDK java, but it did not. Here is how I solved it.
In Windows (after you have installed JDK) you may have several locations/folders
specified in your system environment variables as the PATH to java.exe.
In my case I had 3 references to java. You can check that from command line:
where java
My result was:
C:\Program Files\Java\jre1.8.0_131\bin
C:\Program Files\Java\jdk1.8.0_131\bin
C:\ProgramData\Oracle\Java\javapath
As advised by others I added:
JAVA_PATH variable and pointed it to:
C:\Program Files\Java\jdk1.8.0_131
But that did not solve the issue and I was still running JRE, not JDK java.
I also checked the java control panel ("Configure Java" in start menu item).
First of all note that you must run it as administrator or no changes will stick -
that's what Oracle says. But for me after a reboot the settings were all back to
defaults and all my changes gone.
In case it works for you here are the steps:
Windows start menu
right-click "Configure Java"
More > Run as administrator
enter your admin. password
(if you do not see the password window, look for the icon on your task bar)
Java Control panel will appear
select tab: Java
click: View
select tab: System
click: Find and navigate to your java JDK folder - e.g:
C:\Program Files\Java\jdk1.8.0_131\bin
click: Next
you'll see: C:\Program Files\Java\jdk1.8.0_131\bin\javaw.exe
click: Finish
enable the added entry check-box and disable all others
OK, OK
Now, this was supposed to specify my preference of JDK java over JRE java.
But it did not.
So, at the end I removed all references to java in my PATH - Windows system environment variables
except the one for JDK:
C:\Program Files\Java\jdk1.8.0_131\bin
That did it.
#Felix's answer works. But note, if you're currently running in vscode, you'd need to close and reopen it before it works.

Unable to Start Talend Tool JAVA Version incompatibility

My Talend tool version is 5.6. As mentioned in Talend documentation it needs Java Runtime Environment 7 i.e jdk1.7, which is installed - along with set java_home in my environment variables. As per me it should work.
However I have jdk1.8 installed too, but I'm correctly pointing jdk1.7 path at environment variable.
Alternatively I have tried giving jdk1.7 path in Talend's Talend-Studio-win-x86_64.ini file. It's still giving me error.
Below is snapshot: in cmd the installed version shows jdk1.8 where in echo %JAVA_HOME% it shows path of jdk1.7
While starting tool this error comes:
Create a batch file with the following command:
Talend-Studio-win-x86_64.exe -vm "[jdk path]\bin"
Then start the studio by executing this batch.
Talend is based on eclipse, so you can set the java vm to use in the ini-file. (Sorry, I don't have an installation here right now, I think it is called talend.ini - nevertheless, it is located in talend's installation folder.)
Add the following to the top of the file:
-vm
[path to your java 7]/bin/javaw.exe
try to make changes in TOS_DI-win-x86_64.ini file
add line
-vm
C:\Program Files\Java\jdk-11.0.14\bin\javaw.exe
And update or confirm the version as below.
-Dosgi.requiredJavaVersion=11.0.14
Hope it'll help to fix the issue
Suppose you have talend in c:\talend and jdk1.7 is in C:\jdk1.7.
You can do like the following in windows environment.
Open command prompt.
Goto the bin folder location where jdk 1.7 is located. For example if you have jdk in C:\jdk1.7 then
cd\
cd C:\jdk1.7\bin
Then from bin folder of jdk type the full uri of the executable and hit enter.
In the above supposition c:\jdk1.7\bin>c:\talend\tos_di-xxxxx.exe
In the above statement tos_di-xxxxx.exe is the executable file depending on the os environment

Why does java -version return an old version?

OS: Windows XP
I am using yuicompressor-2.4.2 to compress some CSS before uploading to my server.
But when I run it, the following exception appears:
Exception in thread "main" java.lang.UnsupportedClassVersionError:
com/yahoo/platform/yui/compressor/Bootstrap (Unsupported major.minor version 48.0)
So I think it's because of the JRE.
I typed in the command:
cmd: java -version
And it says:
java version "1.3.1_01"
But it should say 1.6.0_16, since I have installed the latest version.
What should I do to make Java use the latest version instead of the old one?
Set the environment variable JAVA_HOME pointing to the directory where you have jdk 1.6.0
set JAVA_HOME=your_path_to_jdk1.6
set PATH=%JAVA_HOME%/bin;.;..;%PATH%
That's from a command window. Also you can do it from "My PC > Properties > Advanced > Environment variables"
Go to the system32 directory C:\Windows\System32 and delete following 3 files
java.exe
javaw.exe
javaws.exe
Now create a JAVA_HOME environment variable with value={root path of your jdk installation} and add the path till bin folder of your jdk in the PATH environment variable.
Open a fresh command prompt and run java -version to confirm the change
If you are using windows 7/10 go to command prompt and type
where java
Delete all the symbolic link shows below other than your actual installation directory.
Even if correctly added all the environment variables still sometime you can get wrong versions especially when you have multiple version installed in your system and want to switch between them.
On Windows, the JRE installs a java executable in the Windows directory, which should be the first java in your path. This is just a wrapper that looks in the Windows Registry to find the Java home directory (should be "%SystemDrive%\Program Files\Java\jre6" for Java 6) and runs using the libraries there.
Run %SystemRoot%\system32\java -version and see what you get. If that is Java 6, you have entries in your path before %SystemRoot%\system32 (which really should be first). Either fix your %PATH% variable, or you'll have to be explicit whenever you want to run this version of Java.
If running that instance of java doesn't report Java 6, its not installed (correctly). Uninstall and try installing again.
If you are having trouble because of the PATH, it is because you or some software you installed monkeyed with it; I recommend using the default which is to have system32 first. Everything works fine if the defaults are used.
Also, %JAVA_HOME% is not used by the JRE itself at all. Some common Java applications like tomcat and ant honor the %JAVA_HOME% setting, so perhaps yuicompressor does too. But this is a de facto convention, not a standard.
after where java in Command prompt
for example
where java
C:\Program Files\Common Files\Oracle\Java\javapath
C:\Program Files\Java\jdk-11.0.10\bin\java.exe
delete C:\Program Files\Common Files\Oracle folder
then close all terminals and write java -version in the terminal. it will show the right version
worked for me
You should modify your PATH environment variable:
My PC > Right click > properties > Advanced > Environment variables
And modify "Path"
Append at the end the path to your 1.6 installation:
;C:\jdk1.6.xxx\bin
and remove the previous one if present.
Add %JAVA_HOME%/bin to your PATH environment variable where JAVA_HOME is set to your JRE6u16 directory
I had the same problem. In System Properties > Environment Variables > System Variables > PATH make sure there is no other path associated with Java. To make sure, type in and check Java paths.
where java
Re-open Command Prompt and type java -version again. I hope this helps.
first by the following command, you should be aware of .exe file which runs when you type java in the command prompt
where java
C:\Program Files\Common Files\Oracle\Java\javapath
C:\Program Files\Java\jdk-11.0.10\bin\java.exe
as you see above , cmd first reads java from
C:\Program Files\Common Files\Oracle\Java\javapath
so go to the path above and remove java files .
then it should work fine
You should check your PATH environment variable. It is possible that some application you have installed has put its version of the jre in front of yours in the path.
It looks like the older Java version is still on the system PATH environment variable (where the OS looks for commands) or JAVA_HOME (where yuicompressor may look for the java executable)
How those variables are changed depends on your operating system.

Categories