-3

I am using Linux box and setup the Oracle 12c instance and Java JDK. This question has nothing to do with the classNotFound error

[user@10.XXX-XX-00:~]$ java -version
openjdk version "1.8.0_171"
OpenJDK Runtime Environment (build 1.8.0_171-b10)
OpenJDK 64-Bit Server VM (build 25.171-b10, mixed mode)
[user@10.XXX-XX-00:~]$ javac -version
javac 1.8.0_144
[user@10.XXX-XX-00:~]$

also in .profile file. I setup the following paths:

export JAVA_HOME=/usr/jdk1.8.0_144 #/usr/java
export ANT_HOME=/sys_apps_01/apache-ant-1.9.4
export M2_HOME=/sys_apps_01/apache-maven-2.2.1
export M2=$M2_HOME/bin
export ORACLE_HOME=/vol_01/oracle/product/v11.2.0.3/
export PATH=$M2:$PATH:$JAVA_HOME/bin:$ORACLE_HOME/bin

but when I used java -version and javac -version, then why I am getting the OpenJDK details?

when I find for openJDK. I did not get anything.

[root@10.XXX-XX-00 ~]# find / -name "openjdk"
[root@10.XXX-XX-00 ~]#

For user it seems environment variables has been set and not for the root user. How to solve this error?

Application giving me following error -

java.lang.NoClassDefFoundError: Could not initialize class javax.crypto.JceSecurity
    at javax.crypto.Cipher.getInstance(Cipher.java:653)
    at javax.crypto.Cipher.getInstance(Cipher.java:596)
    at com.mastercard.ess.eds.batch.mapper.RawRecordFieldSetMapper.decriptValue(RawRecordFieldSetMapper.java:126)
    at com.mastercard.ess.eds.batch.mapper.RawRecordFieldSetMapper.mapFieldSet(RawRecordFieldSetMapper.java:87)
    at com.mastercard.ess.eds.batch.mapper.RawRecordLineMapper.mapLine(RawRecordLineMapper.java:19)
    at com.mastercard.ess.eds.batch.mapper.RawRecordLineMapper.mapLine(RawRecordLineMapper.java:12)
    at org.springframework.batch.item.file.FlatFileItemReader.doRead(FlatFileItemReader.java:180)
    at org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader.read(AbstractItemCountingItemStreamItemReader.java:88)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:333)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
    at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:133)
    at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:121)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213)
    at com.sun.proxy.$Proxy45.read(Unknown Source)
    at org.springframework.batch.item.support.SynchronizedItemStreamReader.read(SynchronizedItemStreamReader.java:55)
    at org.springframework.batch.core.step.item.SimpleChunkProvider.doRead(SimpleChunkProvider.java:91)
    at org.springframework.batch.core.step.item.FaultTolerantChunkProvider.read(FaultTolerantChunkProvider.java:87)
    at org.springframework.batch.core.step.item.SimpleChunkProvider$1.doInIteration(SimpleChunkProvider.java:116)
    at org.springframework.batch.repeat.support.RepeatTemplate.getNextResult(RepeatTemplate.java:374)
    at org.springframework.batch.repeat.support.RepeatTemplate.executeInternal(RepeatTemplate.java:215)
    at org.springframework.batch.repeat.support.RepeatTemplate.iterate(RepeatTemplate.java:144)
    at org.springframework.batch.core.step.item.SimpleChunkProvider.provide(SimpleChunkProvider.java:110)
    at org.springframework.batch.core.step.item.ChunkOrientedTasklet.execute(ChunkOrientedTasklet.java:69)
    at org.springframework.batch.core.step.tasklet.TaskletStep$ChunkTransactionCallback.doInTransaction(TaskletStep.java:406)
    at org.springframework.batch.core.step.tasklet.TaskletStep$ChunkTransactionCallback.doInTransaction(TaskletStep.java:330)
    at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133)
    at org.springframework.batch.core.step.tasklet.TaskletStep$2.doInChunkContext(TaskletStep.java:271)
    at org.springframework.batch.core.scope.context.StepContextRepeatCallback.doInIteration(StepContextRepeatCallback.java:81)
    at org.springframework.batch.repeat.support.TaskExecutorRepeatTemplate$ExecutingRunnable.run(TaskExecutorRepeatTemplate.java:262)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

Details

uname -a

Linux ech-10-XXX-XX-00 2.6.32-696.13.2.el6.x86_64 #1 SMP Thu Oct 5 17:03:21 PDT 2017 x86_64 x86_64 x86_64 GNU/Linux

I found the

/usr/lib/jvm
[user@:/usr/lib/jvm]$ ll
total 4.0K
drwxr-xr-x 3 root root 4.0K May 21 23:01 java-1.8.0-openjdk-1.8.0.171-8.b10.el6_9.x86_64
lrwxrwxrwx 1 root root   51 Jun 20 07:57 jre-1.8.0-openjdk-1.8.0.171-8.b10.el6_9.x86_64 -> java-1.8.0-openjdk-1.8.0.171-8.b10.el6_9.x86_64/jre
lrwxrwxrwx 1 root root   51 Jun 20 07:57 jre-1.8.0-openjdk.x86_64 -> java-1.8.0-openjdk-1.8.0.171-8.b10.el6_9.x86_64/jre
lrwxrwxrwx 1 root root   21 Jun 20 07:57 jre -> /etc/alternatives/jre
lrwxrwxrwx 1 root root   29 Jun 20 07:57 jre-openjdk -> /etc/alternatives/jre_openjdk
lrwxrwxrwx 1 root root   27 Jun 20 07:57 jre-1.8.0 -> /etc/alternatives/jre_1.8.0
[user@:/usr/lib/jvm]$

Any guidance now ?

Community
  • 1
  • 1
Jeff Cook
  • 7,956
  • 36
  • 115
  • 186
  • Did not specified which Linux distribution you using, but see: https://askubuntu.com/questions/740757/switch-between-multiple-java-versions – Usagi Miyamoto Jul 02 '18 at 14:31
  • uname -a Linux ech-10-XXX-XX-00 2.6.32-696.13.2.el6.x86_64 #1 SMP Thu Oct 5 17:03:21 PDT 2017 x86_64 x86_64 x86_64 GNU/Linux – Jeff Cook Jul 02 '18 at 14:33
  • [Never post pictures of text when you can post the actual text. Be sure that it is properly formatted and readable.](https://meta.stackoverflow.com/questions/285551/why-not-upload-images-of-code-on-so-when-asking-a-question) –  Jul 02 '18 at 16:49
  • Ok I got it. Corrected. Please remove downvote. It blocks us to ask the questions – Jeff Cook Jul 02 '18 at 16:54

1 Answers1

0

Just because you have set JAVA_HOME, does not mean that running java and javac will pick up the commands from this directory.

The search path for executibles is actually stored in the PATH variable.

Try this:

export PATH=$JAVA_HOME/bin:$PATH

This will prepend your defined Java home to the beginning of the path, meaning that when searching for java, this will be the first location checked.

To find the binary that you are _actually running, use

which java
>/c/Program Files/Java/jdk1.8.0_151/bin/java
Matt Clark
  • 27,671
  • 19
  • 68
  • 123