java.lang.NoClassDefFoundError: javax/mail/Authenticator in javaMail - java

I Create a java application that uses send mail, and it working in eclipse when I run. but when i make it jar and run in Terminal(I am Using Ubuntu) java -jar EmailApp.jar it give Following Error :
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.NoClassDefFoundError: javax/mail/Authenticator
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
at java.lang.Class.getMethod0(Class.java:3018)
at java.lang.Class.getMethod(Class.java:1784)
at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
Caused by: java.lang.ClassNotFoundException: javax.mail.Authenticator
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 7 more
My META-INF/MANIFEST.MF :
Manifest-Version: 1.0
Main-Class: com.abc.client.xyz.EmailSender
Class-Path: lib/javax.mail-1.3.3.01.jar
lib/mail-1.4.7.jar
lib/activation-1.1.1.jar
lib/commons-logging-1.1.jar
lib/log4j-1.2.12.jar
lib/commons-collections.jar
lib/commons-dbcp-1.2.1.jar
lib/commons-dbutils-1.0.jar
lib/commons-email-1.1.jar
lib/commons-io.jar
lib/commons-lang-2.5.jar
lib/commons-pool-1.2.jar
lib/commons-pool-20030825.183949.jar
lib/jtds-1.2.5.jar
lib/mysql-connector.jar
lib/idc-dgps4-egn-1.0-SNAPSHOT.jar
The Result of $ ls -al ./lib
total 17100
drwxrwxr-x 2 xyz xyz 4096 Oct 7 15:21 .
drwxrwxr-x 10 xyz xyz 4096 Oct 7 14:26 ..
-rw-rw-r-- 1 xyz xyz 69409 Oct 5 19:20 activation-1.1.1.jar
-rw-rw-r-- 1 xyz xyz 575389 Oct 16 2014 commons-collections.jar
-rw-rw-r-- 1 xyz xyz 107631 Oct 16 2014 commons-dbcp-1.2.1.jar
-rw-rw-r-- 1 xyz xyz 26687 Oct 16 2014 commons-dbutils-1.0.jar
-rw-rw-r-- 1 xyz xyz 30651 Oct 16 2014 commons-email-1.1.jar
-rw-rw-r-- 1 xyz xyz 52543 Oct 16 2014 commons-exec-1.1.jar
-rw-rw-r-- 1 xyz xyz 83613 Oct 16 2014 commons-io.jar
-rw-rw-r-- 1 xyz xyz 279193 Oct 16 2014 commons-lang-2.5.jar
-rw-rw-r-- 1 xyz xyz 52915 Oct 16 2014 commons-logging-1.1.jar
-rw-rw-r-- 1 xyz xyz 42492 Oct 16 2014 commons-pool-1.2.jar
-rw-rw-r-- 1 xyz xyz 38815 Oct 16 2014 commons-pool-20030825.183949.jar
-rw-rw-r-- 1 xyz xyz 865430 Oct 16 2014 idc-dgps4-egn-1.0-SNAPSHOT.jar
-rw-rw-r-- 1 xyz xyz 355030 Jul 11 2015 javax.mail-1.3.3.01.jar
-rw-rw-r-- 1 xyz xyz 708951 Oct 16 2014 js-1.6R5.jar
-rw-rw-r-- 1 xyz xyz 302284 Oct 16 2014 jtds-1.2.5.jar
-rw-rw-r-- 1 xyz xyz 358085 Oct 16 2014 log4j-1.2.12.jar
-rw-rw-r-- 1 xyz xyz 521157 Oct 7 15:20 mail-1.4.7.jar
-rw-rw-r-- 1 xyz xyz 397032 Sep 29 11:06 mysql-connector.jar
-rw-rw-r-- 1 xyz xyz 12598097 Oct 16 2014 tools.jar
NOTE : All the .Jar file in /lib folder.
My Application Structure :
Please Help Me.

Add following jar to your classpath http://repo2.maven.org/maven2/javax/mail/mail/1.4.7/mail-1.4.7.jar

Related

Cannot generate allure report from allure docker

I have tested with testng.xml and got the folder called allure-results on my linux host. This folder has many .json files
-rw-rw-r-- 1 root root 202 Jan 27 03:20 038526c0-e53c-4907-a04b-7061eff12e91-container.json
-rw-rw-r-- 1 root root 548 Jan 27 03:20 17bd74ad-1f5e-4ef9-9f21-b2ec85cfca47-container.json
-rw-rw-r-- 1 root root 419 Jan 27 03:20 1bd85195-ab0d-4e17-ab12-800e5037405f-container.json
-rw-rw-r-- 1 root root 195 Jan 27 03:20 1f6a2505-8c58-452d-a564-e7ffa9512599-container.json
-rw-rw-r-- 1 root root 837 Jan 27 03:20 4fb8431a-162a-4f33-889b-2e5ee5c01843-result.json
-rw-rw-r-- 1 root root 415 Jan 27 03:20 990031d8-60eb-4379-8864-aee237fed175-container.json
The docker-compose file I used to create a container is as below.
version: '2'
services:
allure:
image: "frankescobar/allure-docker-service"
environment:
CHECK_RESULTS_EVERY_SECONDS: 1
KEEP_HISTORY: 1
ports:
- "5050:5050"
volumes:
- $PROJECT_PATH/allure-results:/app/allure-results
- $PROJECT_PATH/allure-reports:/app/default-reports
The project name I created in allure-docker is test.
To generate allure report, I request this URL.
http://192.168.100.58:5050/allure-docker-service/generate-report?project_id=test but got nothing in there.
I can see the same .json files in the container's path as they are correctly mounted as a volume.
allure#0ff7067fedb0:/app/allure-results$ ll
total 36
drwxrwxr-x 2 root root 4096 Jan 27 03:20 ./
drwxr-xr-x 1 allure allure 4096 Dec 14 10:03 ../
-rw-rw-r-- 1 root root 202 Jan 27 03:20 038526c0-e53c-4907-a04b-7061eff12e91-container.json
-rw-rw-r-- 1 root root 548 Jan 27 03:20 17bd74ad-1f5e-4ef9-9f21-b2ec85cfca47-container.json
-rw-rw-r-- 1 root root 419 Jan 27 03:20 1bd85195-ab0d-4e17-ab12-800e5037405f-container.json
-rw-rw-r-- 1 root root 195 Jan 27 03:20 1f6a2505-8c58-452d-a564-e7ffa9512599-container.json
-rw-rw-r-- 1 root root 837 Jan 27 03:20 4fb8431a-162a-4f33-889b-2e5ee5c01843-result.json
-rw-rw-r-- 1 root root 415 Jan 27 03:20 990031d8-60eb-4379-8864-aee237fed175-container.json
allure#0ff7067fedb0:/app/allure-results$
Question What am I missing to get the allure report?
I found the answer myself.
To generate a report, actually, I don't have to generate it manually as this allure-docker generates reports automatically if new results in the results directory are detected.
To get the report, remove allure-docker-service from URL request. Hence, it should be like,
http://192.168.100.58:5050/generate-report?project_id=test

Accessing folder outside user.home is returning false in Linux

I have installed tomcat and deployed a java web application in that in Redhat.
My System property user.home is pointing to /opt/tomcat.
This application tries to access a file path like this
root = new File(rootPath);
if (!root.isDirectory()) {
throw new IllegalArgumentException("Root is not a directory!");
}
Now i want to access any folder outside /opt like a sibling to /opt, it results false in root.isDirectory(). But if a folder is inside /opt/tomcat then it is properly returning as true.
Both the folders /opt and /nasdata(folder which i want to access) have same permissions.
UPDATED
ls -la /opt
drwxr-xr-x. 8 root root 4096 Jul 21 16:15 .
dr-xr-xr-x. 21 root root 4096 Jul 21 20:53 ..
drwxr-xr-x 10 tomcat tomcat 4096 Jul 26 21:20 tomcat
ls -la /opt/tomcat
drwxr-xr-x 10 tomcat tomcat 4096 Jul 26 21:20 .
drwxr-xr-x. 8 root root 4096 Jul 21 16:15 ..
drwxr-x--- 2 tomcat tomcat 4096 Jul 21 16:15 bin
-rw-r----- 1 tomcat tomcat 18949 Jun 28 01:46 BUILDING.txt
drwxr-x--- 3 tomcat tomcat 4096 Jul 23 09:20 conf
-rw-r----- 1 tomcat tomcat 6210 Jun 28 01:46 CONTRIBUTING.md
drwxr-x--- 2 tomcat tomcat 4096 Jul 21 20:14 lib
-rw-r----- 1 tomcat tomcat 57092 Jun 28 01:46 LICENSE
drwxr-x--- 2 tomcat tomcat 4096 Jul 28 04:58 logs
lrwxrwxrwx 1 root root 9 Jul 26 21:20 nasdata -> /nasdata/
-rw-r----- 1 tomcat tomcat 2333 Jun 28 01:46 NOTICE
drwxr-x--- 2 tomcat tomcat 4096 Jul 23 09:20 .oracle_jre_usage
-rw-r----- 1 tomcat tomcat 3372 Jun 28 01:46 README.md
-rw-r----- 1 tomcat tomcat 6898 Jun 28 01:46 RELEASE-NOTES
-rw-r----- 1 tomcat tomcat 16507 Jun 28 01:46 RUNNING.txt
drwxr-x--- 2 tomcat tomcat 4096 Jul 23 09:34 temp
drwxr-x--- 9 tomcat tomcat 4096 Jul 23 09:37 webapps
drwxr-x--- 3 tomcat tomcat 4096 Jul 21 16:28 work
ls -la of my root folder. I am trying to access nasdata folder and giving /nasdata as the path.
dr-xr-xr-x. 21 root root 4096 Jul 21 20:53 .
dr-xr-xr-x. 21 root root 4096 Jul 21 20:53 ..
-rw-r--r-- 1 root root 0 Feb 4 20:43 .autorelabel
lrwxrwxrwx. 1 root root 7 Feb 4 20:39 bin -> usr/bin
dr-xr-xr-x. 5 root root 4096 Feb 4 20:52 boot
drwxr-xr-x 19 root root 3220 Jul 21 14:04 dev
drwxr-xr-x. 89 root root 4096 Jul 21 21:00 etc
drwxr-xr-x. 2 root root 4096 Feb 4 20:39 home
drwxr-xr-x 3 root root 4096 Jul 21 16:55 home2
lrwxrwxrwx. 1 root root 7 Feb 4 20:39 lib -> usr/lib
lrwxrwxrwx. 1 root root 9 Feb 4 20:39 lib64 -> usr/lib64
drwxr-xr-x. 5 root root 1024 Jul 21 16:58 localhome
drwx------. 2 root root 16384 Feb 4 20:38 lost+found
drwxr-xr-x. 2 root root 4096 Dec 14 2017 media
drwxr-xr-x. 2 root root 4096 Dec 14 2017 mnt
drwxrwxr-x 2 root 9999 4096 Jul 26 16:58 nasdata
drwxr-xr-x. 8 root root 4096 Jul 21 16:15 opt
dr-xr-xr-x 150 root root 0 Jul 21 14:04 proc
dr-xr-x---. 7 root root 4096 Jul 21 16:26 root
drwxr-xr-x 30 root root 980 Jul 21 16:46 run
lrwxrwxrwx. 1 root root 8 Feb 4 20:39 sbin -> usr/sbin
-rw-r--r-- 1 root root 127599309 Jul 21 20:53 sk
drwxr-xr-x. 2 root root 4096 Dec 14 2017 srv
dr-xr-xr-x 13 root root 0 Jul 21 14:04 sys
drwxrwxrwt. 14 root root 4096 Jul 28 03:43 tmp
drwxr-xr-x. 14 root root 4096 Jul 21 16:08 usr
drwxr-xr-x. 20 root root 4096 Feb 4 20:46 var
Best Regards,
Saurav

Error while creating multi release jar "entry: A.class, contains a class with internal name com.vipin.exp.A, names do not match"

Here java9/com/vipin/exp/A.class is file I want to use with jdk 9 and for other versions java8/com/vipin/exp/A.class. For this I am trying to create multi release jar but getting below error. What is wrong in this command ?
XXXX#XXX-MacBook-Air.local:~/javacode$ pwd
/Users/XXXX/javacode
XXXX#XXX-Air:~/javacode$ javac --release 9 -d /Users/nitinkumarsharma/javacode/java9/ java9/com/vipin/exp/A.java
XXXX#XXX-Air:~/javacode$ javac --release 8 -d /Users/nitinkumarsharma/javacode/java8/ java8/com/vipin/exp/A.java
XXXX#XXX-Air:~/javacode$ jar -c -f vipin.jar -C java8/com/vipin/exp/ . --release 9 -C java9/com/vipin/exp/ .
entry: A.class, contains a class with internal name com.vipin.exp.A, names do not match
entry: META-INF/versions/9/A.class, contains a new public class not found in base entries
Warning: entry META-INF/versions/9/A.java, multiple resources with same name
invalid multi-release jar file vipin.jar deleted
My directory structure is:
XXXX#XXX-MacBook-Air.local:~/javacode$ tree
.
|____java8
| |____com
| | |____vipin
| | | |____exp
| | | | |____A.class
| | | | |____A.java
|____java9
| |____com
| | |____vipin
| | | |____exp
| | | | |____A.class
| | | | |____A.java
It works well when I use only one class file to create jar, like below
XXXX#XXX-MacBook-Air.local:~/javacode$ jar -c -f vipin.jar -C java8/com/vipin/exp/ .
XXXX#XXX-MacBook-Air.local:~/javacode$ ls -ltr
total 12688
drwxr-xr-x 3 XXXX staff 102 Oct 17 18:02 java8
drwxr-xr-x 3 XXXX staff 102 Oct 17 20:00 java9
-rw-r--r-- 1 XXXX staff 968 Oct 18 17:05 vipin.jar
XXXX#XXX-MacBook-Air.local:~/javacode$ jar -tvf vipin.jar
0 Wed Oct 18 17:05:08 IST 2017 META-INF/
61 Wed Oct 18 17:05:08 IST 2017 META-INF/MANIFEST.MF
430 Tue Oct 17 22:55:22 IST 2017 A.class
136 Tue Oct 17 22:49:20 IST 2017 A.java
My understanding of -C option was wrong, I should have given top level directory after -C.
XXXX#XXX-MacBook-Air.local:~/javacode$ jar -c -f vipin.jar -C java8 . --release 9 -C java9 .
Warning: entry META-INF/versions/9/com/vipin/exp/A.java, multiple resources with same name
XXXX#XXX-MacBook-Air.local:~/javacode$ jar -tvf vipin.jar
0 Wed Oct 18 19:06:26 IST 2017 META-INF/
82 Wed Oct 18 19:06:26 IST 2017 META-INF/MANIFEST.MF
0 Tue Oct 17 18:02:04 IST 2017 com/
0 Tue Oct 17 18:02:04 IST 2017 com/vipin/
0 Tue Oct 17 23:26:56 IST 2017 com/vipin/exp/
430 Wed Oct 18 19:00:38 IST 2017 com/vipin/exp/A.class
136 Tue Oct 17 22:49:20 IST 2017 com/vipin/exp/A.java
0 Tue Oct 17 20:00:34 IST 2017 META-INF/versions/9/
0 Tue Oct 17 20:00:34 IST 2017 META-INF/versions/9/com/
0 Tue Oct 17 20:00:34 IST 2017 META-INF/versions/9/com/vipin/
0 Tue Oct 17 23:27:04 IST 2017 META-INF/versions/9/com/vipin/exp/
430 Wed Oct 18 19:02:04 IST 2017 META-INF/versions/9/com/vipin/exp/A.class
135 Tue Oct 17 22:49:26 IST 2017 META-INF/versions/9/com/vipin/exp/A.java
The command worked given in question above produced wrong output, correct one would be below and you can see in tvf output the class file is available in correct structure com/vipin/exp/A.class
XXXX#XXX-MacBook-Air.local:~/javacode$ jar -c -f vipin_test.jar -C java8 .
XXXX#XXX-MacBook-Air.local:~/javacode$ jar -tvf vipin_test.jar
0 Wed Oct 18 19:20:18 IST 2017 META-INF/
61 Wed Oct 18 19:20:18 IST 2017 META-INF/MANIFEST.MF
0 Tue Oct 17 18:02:04 IST 2017 com/
0 Tue Oct 17 18:02:04 IST 2017 com/vipin/
0 Tue Oct 17 23:26:56 IST 2017 com/vipin/exp/
430 Wed Oct 18 19:00:38 IST 2017 com/vipin/exp/A.class
136 Tue Oct 17 22:49:20 IST 2017 com/vipin/exp/A.java
Some more commands to show it worked perfectly.
XXXX#XXX-MacBook-Air.local:~/javacode$ java -version
java version "9"
Java(TM) SE Runtime Environment (build 9+181)
Java HotSpot(TM) 64-Bit Server VM (build 9+181, mixed mode)
XXXX#XXX-MacBook-Air.local:~/javacode$ java -cp vipin.jar com.vipin.exp.A
Inside java9 version
XXXX#XXX-MacBook-Air.local:~/javacode$ /Library/Java/JavaVirtualMachines/jdk1.8.0_111.jdk/Contents/Home/bin/java -version
java version "1.8.0_111"
XXXX#XXX-MacBook-Air.local:~/javacode$ /Library/Java/JavaVirtualMachines/jdk1.8.0_111.jdk/Contents/Home/bin/java -cp vipin.jar com.vipin.exp.A
Inside java8 version

Maven - Error: Could not find or load main class org.codehaus.plexus.classworlds.launcher.Launcher

I know this question has been posted a lot, but I still can't resolve my problem.
So, I just downloaded a bin distribution from http://apache.mirrors.hoobly.com/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.zip
after extracting the zip file, I moved it to /opt/apache-maven-3.3.9
Here's how my terminal look like when I run the commands:
xxx#xxx-VirtualBox:/opt/apache-maven-3.3.9/bin$ ls
m2.conf mvn mvnDebug
xxx#xxx-VirtualBox:/opt/apache-maven-3.3.9/bin$ ./mvn
Error: Could not find or load main class org.codehaus.plexus.classworlds.launcher.Launcher
xxx#xxx-VirtualBox:/opt/apache-maven-3.3.9/bin$ java -version
java version "1.7.0_80"
Java(TM) SE Runtime Environment (build 1.7.0_80-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.80-b11, mixed mode)
xxx#xxx-VirtualBox:/opt/apache-maven-3.3.9/bin$ printenv JAVA_HOME
/usr/lib/jvm/java-7-oracle
Java is installed correctly, but I still can't run the mvn executable file
The result of ls -lR /opt/apache-maven-3.3.9 is as follows:
xxx#xxx-VirtualBox:/opt/apache-maven-3.3.9/bin$ ls -lR /opt/apache-maven-3.3.9/
/opt/apache-maven-3.3.9/:
total 16
drwxr-xr-x 2 root root 4096 Jul 21 11:12 bin
drwxr-xr-x 2 root root 4096 Jul 21 11:12 boot
lrwxrwxrwx 1 root root 10 Dec 9 2015 conf -> /etc/maven
drwxr-xr-x 2 root root 4096 Jul 21 11:12 lib
drwxr-xr-x 2 root root 4096 Jul 21 11:12 man
/opt/apache-maven-3.3.9/bin:
total 12
lrwxrwxrwx 1 root root 18 Dec 9 2015 m2.conf -> /etc/maven/m2.conf
-rwxr-xr-x 1 root root 7383 Nov 19 2015 mvn
-rwxr-xr-x 1 root root 1815 Nov 19 2015 mvnDebug
/opt/apache-maven-3.3.9/boot:
total 0
lrwxrwxrwx 1 root root 34 Dec 9 2015 plexus-classworlds-2.x.jar -> ../../java/plexus-classworlds2.jar
/opt/apache-maven-3.3.9/lib:
total 0
lrwxrwxrwx 1 root root 26 Dec 9 2015 aopalliance.jar -> ../../java/aopalliance.jar
lrwxrwxrwx 1 root root 22 Dec 9 2015 cdi-api.jar -> ../../java/cdi-api.jar
lrwxrwxrwx 1 root root 26 Dec 9 2015 commons-cli.jar -> ../../java/commons-cli.jar
lrwxrwxrwx 1 root root 25 Dec 9 2015 commons-io.jar -> ../../java/commons-io.jar
lrwxrwxrwx 1 root root 28 Dec 9 2015 commons-lang3.jar -> ../../java/commons-lang3.jar
lrwxrwxrwx 1 root root 27 Dec 9 2015 commons-lang.jar -> ../../java/commons-lang.jar
lrwxrwxrwx 1 root root 33 Dec 9 2015 eclipse-aether-api.jar -> ../../java/eclipse-aether-api.jar
lrwxrwxrwx 1 root root 45 Dec 9 2015 eclipse-aether-connector-basic.jar -> ../../java/eclipse-aether-connector-basic.jar
lrwxrwxrwx 1 root root 34 Dec 9 2015 eclipse-aether-impl.jar -> ../../java/eclipse-aether-impl.jar
lrwxrwxrwx 1 root root 33 Dec 9 2015 eclipse-aether-spi.jar -> ../../java/eclipse-aether-spi.jar
lrwxrwxrwx 1 root root 45 Dec 9 2015 eclipse-aether-transport-wagon.jar -> ../../java/eclipse-aether-transport-wagon.jar
lrwxrwxrwx 1 root root 34 Dec 9 2015 eclipse-aether-util.jar -> ../../java/eclipse-aether-util.jar
lrwxrwxrwx 1 root root 20 Dec 9 2015 guava.jar -> ../../java/guava.jar
lrwxrwxrwx 1 root root 20 Dec 9 2015 guice.jar -> ../../java/guice.jar
lrwxrwxrwx 1 root root 38 Dec 9 2015 javax.inject.jar -> ../../java/atinject-jsr330-tck-1.0.jar
lrwxrwxrwx 1 root root 20 Dec 9 2015 jsoup.jar -> ../../java/jsoup.jar
lrwxrwxrwx 1 root root 37 Dec 9 2015 maven-aether-provider-3.x.jar -> ../../java/maven3-aether-provider.jar
lrwxrwxrwx 1 root root 30 Dec 9 2015 maven-artifact-3.x.jar -> ../../java/maven3-artifact.jar
lrwxrwxrwx 1 root root 37 Dec 9 2015 maven-builder-support-3.x.jar -> ../../java/maven3-builder-support.jar
lrwxrwxrwx 1 root root 28 Dec 9 2015 maven-compat-3.x.jar -> ../../java/maven3-compat.jar
lrwxrwxrwx 1 root root 26 Dec 9 2015 maven-core-3.x.jar -> ../../java/maven3-core.jar
lrwxrwxrwx 1 root root 30 Dec 9 2015 maven-embedder-3.x.jar -> ../../java/maven3-embedder.jar
lrwxrwxrwx 1 root root 27 Dec 9 2015 maven-model-3.x.jar -> ../../java/maven3-model.jar
lrwxrwxrwx 1 root root 35 Dec 9 2015 maven-model-builder-3.x.jar -> ../../java/maven3-model-builder.jar
lrwxrwxrwx 1 root root 32 Dec 9 2015 maven-plugin-api-3.x.jar -> ../../java/maven3-plugin-api.jar
lrwxrwxrwx 1 root root 41 Dec 9 2015 maven-repository-metadata-3.x.jar -> ../../java/maven3-repository-metadata.jar
lrwxrwxrwx 1 root root 30 Dec 9 2015 maven-settings-3.x.jar -> ../../java/maven3-settings.jar
lrwxrwxrwx 1 root root 38 Dec 9 2015 maven-settings-builder-3.x.jar -> ../../java/maven3-settings-builder.jar
lrwxrwxrwx 1 root root 28 Dec 9 2015 plexus-cipher.jar -> ../../java/plexus-cipher.jar
lrwxrwxrwx 1 root root 47 Dec 9 2015 plexus-component-annotations.jar -> ../../java/plexus-component-annotations-1.5.jar
lrwxrwxrwx 1 root root 35 Dec 9 2015 plexus-interpolation.jar -> ../../java/plexus-interpolation.jar
lrwxrwxrwx 1 root root 36 Dec 9 2015 plexus-sec-dispatcher.jar -> ../../java/plexus-sec-dispatcher.jar
lrwxrwxrwx 1 root root 28 Dec 9 2015 plexus-utils.jar -> ../../java/plexus-utils2.jar
lrwxrwxrwx 1 root root 26 Dec 9 2015 sisu-inject.jar -> ../../java/sisu-inject.jar
lrwxrwxrwx 1 root root 26 Dec 9 2015 sisu-plexus.jar -> ../../java/sisu-plexus.jar
lrwxrwxrwx 1 root root 24 Dec 9 2015 slf4j-api.jar -> ../../java/slf4j-api.jar
lrwxrwxrwx 1 root root 27 Dec 9 2015 slf4j-simple.jar -> ../../java/slf4j-simple.jar
lrwxrwxrwx 1 root root 29 Dec 9 2015 wagon-file.jar -> ../../java/wagon-file-2.x.jar
lrwxrwxrwx 1 root root 36 Dec 9 2015 wagon-http-shaded.jar -> ../../java/wagon-http-shaded-2.x.jar
lrwxrwxrwx 1 root root 36 Dec 9 2015 wagon-http-shared.jar -> ../../java/wagon-http-shared-2.x.jar
lrwxrwxrwx 1 root root 37 Dec 9 2015 wagon-provider-api.jar -> ../../java/wagon-provider-api-2.x.jar
/opt/apache-maven-3.3.9/man:
total 8
-rw-r--r-- 1 root root 1229 Nov 19 2015 mvn.1.gz
-rw-r--r-- 1 root root 1240 Nov 19 2015 mvnDebug.1.gz
Windows 7, JDK 8 ->
In my case there was a problem with the .zip file, which I have taken from Maven site. I've found that there was nothing in this \boot folder. There should be that
plexus-classworld which shows that org.codehaus.plexus.classworlds.launcher.Launcher.
for %%i in ("%MAVEN_HOME%"\boot\plexus-classworlds-) do set CLASSWORLDS_JAR="%%i"
set CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher*
I downloaded new Maven (.tar), set MAVEN_HOME and PATH.
Now it works.
So CHECK THAT FOLDER. IF EMPTY, DOWNLOAD NEW ONE.

Intellij 15 Error: could not find libjava.dylib

I installed Intellj 15 in my macos. While running it throws following error.
$ /Applications/IntelliJ\ IDEA\ 15\ CE.app/Contents/MacOS/idea
2016-05-21 18:07:53.774 idea[1307:51782] Value of IDEA_JDK: (null)
2016-05-21 18:07:53.778 idea[1307:51795] fullFileName is: /Applications/IntelliJ IDEA 15 CE.app/Contents/bin/idea.vmoptions
2016-05-21 18:07:53.778 idea[1307:51795] fullFileName exists: /Applications/IntelliJ IDEA 15 CE.app/Contents/bin/idea.vmoptions
2016-05-21 18:07:53.778 idea[1307:51795] Value of IDEA_VM_OPTIONS is (null)
2016-05-21 18:07:53.778 idea[1307:51795] Processing VMOptions file at /Applications/IntelliJ IDEA 15 CE.app/Contents/bin/idea.vmoptions
2016-05-21 18:07:53.779 idea[1307:51795] Done
Error: could not find libjava.dylib
Failed to GetJREPath()
2016-05-21 18:07:53.779 idea[1307:51795] JNI_CreateJavaVM (/Applications/IntelliJ IDEA 15 CE.app/Contents/jre/jdk) failed: 4294967295
I have JAVA_HOME set as
export JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/"
I have libjava.dylib in /Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/jre/lib/.
Also, I have libjava.dylib in /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/
$ ll /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/
total 251384
drwxrwxr-x 2 root wheel 68 Feb 1 22:02 applet
-rw-rw-r-- 1 root wheel 1378 Dec 22 18:26 calendars.properties
-rw-rw-r-- 1 root wheel 3133473 Dec 22 18:26 charsets.jar
-rw-rw-r-- 1 root wheel 72450 Dec 22 18:26 classlist
drwxrwxr-x 7 root wheel 238 Feb 1 22:02 cmm
-rw-rw-r-- 1 root wheel 5916 Dec 22 18:26 content-types.properties
-rw-rw-r-- 1 root wheel 4122 Dec 22 18:26 currency.data
drwxrwxr-x 24 root wheel 816 Feb 1 22:02 deploy
-rw-rw-r-- 1 root wheel 2218758 Dec 22 18:28 deploy.jar
drwxrwxr-x 13 root wheel 442 Feb 1 22:02 ext
-rw-rw-r-- 1 root wheel 4116 Dec 22 18:26 flavormap.properties
-rw-rw-r-- 1 root wheel 3058 Dec 22 18:26 fontconfig.bfc
-rw-rw-r-- 1 root wheel 8087 Dec 22 18:26 fontconfig.properties.src
drwxrwxr-x 11 root wheel 374 Feb 1 22:02 fonts
-rw-rw-r-- 1 root wheel 13962 Dec 22 18:26 hijrah-config-umalqura.properties
drwxrwxr-x 3 root wheel 102 Oct 6 2015 images
-rw-rw-r-- 1 root wheel 55 Dec 22 16:03 javafx.properties
-rw-rw-r-- 1 root wheel 471677 Dec 22 18:28 javaws.jar
-rw-rw-r-- 1 root wheel 114950 Dec 22 18:26 jce.jar
drwxrwxr-x 4 root wheel 136 Feb 1 22:02 jfr
-rw-rw-r-- 1 root wheel 560452 Dec 22 18:26 jfr.jar
-rw-rw-r-- 1 root wheel 33930 Dec 22 16:03 jfxswt.jar
drwxrwxr-x 3 root wheel 102 Feb 1 22:02 jli
-rwxrwxr-x 1 root wheel 15136 Dec 22 18:26 jspawnhelper
-rw-rw-r-- 1 root wheel 633834 Dec 22 18:26 jsse.jar
-rw-rw-r-- 1 root wheel 624 Dec 22 18:26 jvm.cfg
-rw-rw-r-- 1 root wheel 4226 Dec 22 18:26 jvm.hprof.txt
-rw-rw-r-- 1 root wheel 45120 Dec 22 18:26 libAppleScriptEngine.dylib
-rw-rw-r-- 1 root wheel 16068 Dec 22 18:26 libattach.dylib
-rw-rw-r-- 1 root wheel 552948 Dec 22 18:26 libawt.dylib
-rwxrwxr-x 1 root wheel 721004 Dec 22 18:26 libawt_lwawt.dylib
-rwxrwxr-x 1 root wheel 9164 Dec 22 18:26 libbci.dylib
-rw-rw-r-- 1 root wheel 186456 Dec 22 18:26 libdcpr.dylib
-rwxrwxr-x 1 root wheel 62900 Dec 22 16:03 libdecora_sse.dylib
-rw-rw-r-- 1 root wheel 166872 Dec 22 18:28 libdeploy.dylib
-rw-rw-r-- 1 root wheel 25616 Dec 22 18:26 libdt_socket.dylib
-rw-rw-r-- 1 root wheel 419360 Dec 22 18:26 libfontmanager.dylib
-rwxrwxr-x 1 root wheel 174156 Dec 22 16:03 libfxplugins.dylib
-rw-rw-r-- 1 root wheel 380580 Dec 22 16:03 libglass.dylib
-rwxrwxr-x 1 root wheel 1185040 Dec 22 16:03 libglib-lite.dylib
-rw-rw-r-- 1 root wheel 1537888 Dec 22 16:03 libgstreamer-lite.dylib
-rw-rw-r-- 1 root wheel 212872 Dec 22 18:26 libhprof.dylib
-rw-rw-r-- 1 root wheel 142392 Dec 22 18:26 libinstrument.dylib
-rw-rw-r-- 1 root wheel 41124 Dec 22 18:26 libj2gss.dylib
-rw-rw-r-- 1 root wheel 15092 Dec 22 18:26 libj2pcsc.dylib
-rw-rw-r-- 1 root wheel 70692 Dec 22 18:26 libj2pkcs11.dylib
-rw-rw-r-- 1 root wheel 8852 Dec 22 18:26 libjaas_unix.dylib
-rw-rw-r-- 1 root wheel 216684 Dec 22 18:26 libjava.dylib
-rw-rw-r-- 1 root wheel 28896 Dec 22 18:26 libjava_crw_demo.dylib
-rwxrwxr-x 1 root wheel 38524 Dec 22 16:03 libjavafx_font.dylib
-rwxrwxr-x 1 root wheel 776700 Dec 22 16:03 libjavafx_font_t2k.dylib
-rwxrwxr-x 1 root wheel 250956 Dec 22 16:03 libjavafx_iio.dylib
-rw-rw-r-- 1 root wheel 8652 Dec 22 18:26 libjawt.dylib
-rw-rw-r-- 1 root wheel 304248 Dec 22 18:26 libjdwp.dylib
-rw-rw-r-- 1 root wheel 25328 Dec 22 18:26 libjfr.dylib
-rw-rw-r-- 1 root wheel 240840 Dec 22 16:03 libjfxmedia.dylib
-rwxrwxr-x 1 root wheel 214088 Dec 22 16:03 libjfxmedia_avf.dylib
-rwxrwxr-x 1 root wheel 53104 Dec 22 16:03 libjfxmedia_qtkit.dylib
-rw-rw-r-- 1 root wheel 38159152 Dec 22 16:03 libjfxwebkit.dylib
-rw-rw-r-- 1 root wheel 180468 Dec 22 18:26 libjpeg.dylib
-rw-rw-r-- 1 root wheel 14628 Dec 22 18:26 libjsdt.dylib
-rw-rw-r-- 1 root wheel 15744 Dec 22 18:26 libjsig.dylib
-rw-rw-r-- 1 root wheel 74872 Dec 22 18:26 libjsound.dylib
-rw-rw-r-- 1 root wheel 374428 Dec 22 18:26 libkcms.dylib
-rwxrwxr-x 1 root wheel 333072 Dec 22 18:26 liblcms.dylib
-rw-rw-r-- 1 root wheel 53576 Dec 22 18:26 libmanagement.dylib
-rw-rw-r-- 1 root wheel 834796 Dec 22 18:26 libmlib_image.dylib
-rw-rw-r-- 1 root wheel 90964 Dec 22 18:26 libnet.dylib
-rw-rw-r-- 1 root wheel 61444 Dec 22 18:26 libnio.dylib
-rw-rw-r-- 1 root wheel 198936 Dec 22 18:28 libnpjp2.dylib
-rw-rw-r-- 1 root wheel 15684 Dec 22 18:26 libnpt.dylib
-rw-rw-r-- 1 root wheel 55364 Dec 22 18:26 libosx.dylib
-rw-rw-r-- 1 root wheel 110948 Dec 22 18:26 libosxapp.dylib
-rw-rw-r-- 1 root wheel 14424 Dec 22 18:26 libosxkrb5.dylib
-rw-rw-r-- 1 root wheel 36068 Dec 22 18:26 libosxui.dylib
-rwxrwxr-x 1 root wheel 54732 Dec 22 16:03 libprism_common.dylib
-rwxrwxr-x 1 root wheel 62236 Dec 22 16:03 libprism_es2.dylib
-rwxrwxr-x 1 root wheel 67968 Dec 22 16:03 libprism_sw.dylib
-rwxrwxr-x 1 root wheel 10104 Dec 22 18:26 libresource.dylib
-rw-rw-r-- 1 root wheel 77036 Dec 22 18:26 libsaproc.dylib
-rw-rw-r-- 1 root wheel 348848 Dec 22 18:26 libsplashscreen.dylib
-rw-rw-r-- 1 root wheel 161704 Dec 22 18:26 libsunec.dylib
-rw-rw-r-- 1 root wheel 310336 Dec 22 18:26 libt2k.dylib
-rw-rw-r-- 1 root wheel 102100 Dec 22 18:26 libunpack.dylib
-rw-rw-r-- 1 root wheel 49472 Dec 22 18:26 libverify.dylib
-rw-rw-r-- 1 root wheel 36600 Dec 22 18:26 libzip.dylib
-rw-rw-r-- 1 root wheel 2455 Dec 22 18:26 logging.properties
drwxrwxr-x 6 root wheel 204 Feb 1 22:02 management
-rw-rw-r-- 1 root wheel 381 Dec 22 18:26 management-agent.jar
-rw-rw-r-- 1 root wheel 2107 Dec 22 18:26 meta-index
-rw-rw-r-- 1 root wheel 3070 Dec 22 18:26 net.properties
drwxrwxr-x 5 root wheel 170 Feb 1 22:02 nibs
-rw-rw-r-- 1 root wheel 944069 Dec 22 18:28 plugin.jar
-rw-rw-r-- 1 root wheel 2796 Dec 22 18:26 psfont.properties.ja
-rw-rw-r-- 1 root wheel 10393 Dec 22 18:26 psfontj2d.properties
-rw-rw-r-- 1 root wheel 3502025 Dec 22 18:26 resources.jar
-rw-rw-r-- 1 root wheel 66604445 Dec 22 18:26 rt.jar
drwxrwxr-x 11 root wheel 374 Feb 1 22:02 security
drwxrwxr-x 5 root wheel 170 Feb 1 22:02 server
drwxrwxr-x 3 root wheel 102 Feb 1 22:02 shortcuts
-rw-rw-r-- 1 root wheel 1210 Dec 22 18:26 sound.properties
-rw-rw-r-- 1 root wheel 102332 Dec 22 18:26 tzdb.dat
I copied the file to IntelliJ/jre, still no luck.
$ ll /Applications/IntelliJ\ IDEA\ 15\ CE.app/Contents/jre/jdk/Contents/MacOS/
total 552
-rw-r--r-- 1 root admin 216684 May 21 18:22 libjava.dylib
-rwxr-xr-x# 1 root admin 61704 Jan 5 22:29 libjli.dylib
I'd the exact same issue but with another version of the application being launched.
When you launch applications such as IntelliJ, Eclipse, etc, they wont use the environment variables even though you set them to something specific. so setting JAVA_HOME to one particular version doesn't help at all.
You need to check what is the default version of Java on MacOS.
You can check that using the following:
$ /usr/libexec/java_home -V
Matching Java Virtual Machines (5):
11.0.1, x86_64: "... 11.0.1" /Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk/Contents/Home
9.0.4, x86_64: "Java SE 9.0.4" /Library/Java/JavaVirtualMachines/jdk-9.0.4.jdk/Contents/Home
1.8.0_162, x86_64: "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_162.jdk/Contents/Home
1.8.0_152, x86_64: "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_152.jdk/Contents/Home
1.8.0_144, x86_64: "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home
/Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk/Contents/Home
The last line points to the default version of Java.
So for me, this was pointing to JDK 11.
Starting from Jdk9 onwards, the location of libjava.dylib is under /Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk/Contents/Home/lib/libjava.dylib.
Also this seems to be broken for JDK-12
Since this was not working for the default version of Java, I disabled both JDK 9 and 11 so that the default version is JDK8.
This can be done by renaming the Info.plist to Info.plist.disabled in <jdk_version>/Contents directory.
sudo mv /Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk/Contents/Info.plist /Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk/Contents/Info.plist.disabled
sudo mv /Library/Java/JavaVirtualMachines/jdk-9.0.4.jdk/Contents/Info.plist /Library/Java/JavaVirtualMachines/jdk-9.0.4.jdk/Contents/Info.plist.disabled
Ran /usr/libexec/java_home -V again which now points to jdk1.8.0_162.
The Application is now launching fine.
libjava.dylib is in the jre's lib directory. On my machine, it installed into (I have build 92 installed):
/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/lib/libjava.dylib
In your case, files in /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/ is not going to make any difference. Intellij does not run as an applet -- that directory is only for the browser plugin used to run Java Applets.
In any case, you should consider downloading and reinstalling the latest build of the JDK from Oracle. If your install is missing libraries, other things may be messed up as well.
Upgrading my gradle to the latest version and setting JAVA_HOME and ANDROID_HOME properly worked for me.
here is my bash_profile:
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_231.jdk/Contents/Home
export ANDROID_HOME=$HOME/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/emulator
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/tools/bin
export PATH=$PATH:$ANDROID_HOME/platform-tools
Gradle Version that worked for me was 6.0.1
maybe you can kill intellij process and restart it

Categories