I just installed java 8 and maven on Mac El Captain. I have set all the environment variables correctly and java -version does display the java version. But when I try to run maven from the terminal I get the following error:
File or url '/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Classes/classes.jar' could not be found
java.net.MalformedURLException: no protocol: /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Classes/classes.jar
at java.net.URL.<init>(URL.java:593)
at java.net.URL.<init>(URL.java:490)
at java.net.URL.<init>(URL.java:439)
at com.werken.forehead.Forehead.loadFileOrUrl(Forehead.java:403)
at com.werken.forehead.Forehead.load(Forehead.java:322)
at com.werken.forehead.Forehead.config(Forehead.java:245)
at com.werken.forehead.Forehead.config(Forehead.java:131)
at com.werken.forehead.Forehead.main(Forehead.java:579)
any ideas?
For Maven 1.x, I found the following bit of the bin/maven shell script caused the same error for me on a Mac:
if $darwin; then
TOOLS_JAR="/System/Library/Frameworks/JavaVM.framework/Versions/${JAVA_VERSION}/Classes/classes.jar"
fi
I simply edited the bin/maven script file and commented out the if $darwin; then ... fi section and it is now working.
The pass where classes
java.net.MalformedURLException: no protocol: /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Classes/classes.jar
I would guess its 'JavaVM.framework' or really amissing protocol like 'file:'
If you installed the JDK in a path like JavaVM.framework, try to installit in another path without '.'
Related
I am at the Java Directory. And When I execute the build command:
docker build -t karthikjohnbabu/hello-world-java:0.0.2.RELEASE .
I get the below error message. Please help me???
failed to solve with frontend dockerfile.v0: failed to create LLB definition: no match for platform in manifest sha256:195e9c227ad891282e80602cac2372a3085ecf4ceefbb395558ffe0f7bb0b9aa: not found.
Complete details of error below:
Try adding the following arg to the command:
--platform=linux/amd64
or alternatively use the following command to set an env var:
export DOCKER_DEFAULT_PLATFORM=linux/amd64
The information you gave leaves room for guessing.
I believe the important part is no match for platform in manifest.
Thus I believe in your dockerfile you start FROM someimage, and this someimage is not available for the platform you are using (which could mean MacOS).
I am trying to generate java files from asn1 file using the below in my android project and facing error in generating the files in Mac OS and in window it worked fine.
org.openmuc:jasn1:1.9.0
org.openmuc:jasn1-compiler:1.9.0
Below is the bash file
#!/bin/bash
JARS_LOCATION="../build/libs-all"
MAIN_CLASS="org.openmuc.jasn1.compiler.Compiler"
SYSPROPS=""
PARAMS=""
SCRIPT_HOME=`dirname $0`
CLASSPATH=$(JARS=("$SCRIPT_HOME"/"$JARS_LOCATION"/*.jar); IFS=:; echo "${JARS[*]}")
for i in $#; do
if [[ $i == -D* ]]; then
SYSPROPS="$SYSPROPS $i";
else
PARAMS="$PARAMS $i";
fi
done
java $SYSPROPS -cp $CLASSPATH $MAIN_CLASS $PARAMS
and the above bash file will be called from my projects build.gradle file.
Below is the final command will be executed from the bash. Shortened the file paths for easy understanding.
java -cp "/libs/antlr-2.7.7.jar:/libs/jasn1-1.9.0.jar:/libs/jasn1-compiler-1.9.0.jar" org.openmuc.jasn1.compiler.Compiler -p com.test.package.asn1 -f /asn1def/asn1/RSPDefinition.asn /asn1def/asn1/PKIX1Explicit88.asn /asn1def/asn1/PKIX1Implicit88.asn -o /asn1def/build/generated/source/java
Below is the error I am getting
Generated code will be saved in /asn1def/build/generated/source/java
Parsing "/asn1def/asn1/RSPDefinition.asn"
Parsing "/asn1def/asn1/PKIX1Explicit88.asn"
Parsing "/asn1def/asn1/PKIX1Implicit88.asn"
Generating classes for module "PKIX1Implicit88"
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/DatatypeConverter
at org.openmuc.jasn1.compiler.HexConverter.toShortHexString(HexConverter.java:63)
at org.openmuc.jasn1.compiler.HexConverter.toShortHexString(HexConverter.java:59)
at org.openmuc.jasn1.compiler.HexConverter.appendShortHexString(HexConverter.java:99)
at org.openmuc.jasn1.compiler.HexConverter.appendHexString(HexConverter.java:108)
at org.openmuc.jasn1.compiler.HexConverter.toHexString(HexConverter.java:9)
at org.openmuc.jasn1.compiler.BerClassWriter.writeEncodeTag(BerClassWriter.java:2169)
at org.openmuc.jasn1.compiler.BerClassWriter.writeSequenceOrSetEncodeFunction(BerClassWriter.java:1107)
at org.openmuc.jasn1.compiler.BerClassWriter.writeSequenceOrSetClass(BerClassWriter.java:731)
at org.openmuc.jasn1.compiler.BerClassWriter.writeConstructedTypeClass(BerClassWriter.java:493)
at org.openmuc.jasn1.compiler.BerClassWriter.translateModule(BerClassWriter.java:194)
at org.openmuc.jasn1.compiler.BerClassWriter.translate(BerClassWriter.java:133)
at org.openmuc.jasn1.compiler.Compiler.main(Compiler.java:89)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.DatatypeConverter
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 12 more
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':asn1def:compileAsn'.
> Process 'command '/asn1def/run-scripts/jasn1-compiler'' finished with non-zero exit value 1
I have the main class in the jasn1-compiler-1.9.0.jar file in the libs folder. The same generate files in windows but in Mac it is not working. The difference in windows & Mac is Java version. Mac has Java 11 & windows has Java 1.8. I also tried adding the JDK 1.8 location as below at the end of above code.
-Dorg.gradle.java.home=/Users/Shared/Jenkins/.jenkins/tools/hudson.model.JDK/JDK_1_8
Can anyone help me to point out what's missing?
Finally I found the answer. The error was happened because of the Java version in Mac, it has Java 11 and it didn't support javax xml bind. So I installed the JDK 1.8 in the mac machine and use that path in the bash file as below before the java execution line in bash file.
export JAVA_HOME=/usr/java/jdk1.8.161/
It may useful for someone.
I am using NCache NodeJS client package and writing tests by calling NCache API's. Package has dependency of Java. After I installed and used that package to write simple test. Test execution failed with module not Found error:
Error Message
Messgae:
The specified module could not be found.
\\D:\GitHome\Test\node_modules\java\build\Release\nodejavabridge_bindings.node
at Runtime._loadModule (node_modules/jest-runtime/build/index.js:893:29)
at Object.<anonymous> (node_modules/java/lib/nodeJavaBridge.js:21:16)
File in above mentioned directory exits.
Note: When I used that package in simple index.js file it worked fine as expected but unable to run with jest.
No major configuration done for jest in package.json file.
Java jdk-11.0.6 installed on box and JAVA_HOME is set.
Package.json
test.specs.js
Unable to identify the exact reason of failure therefore stuck on how to resolve it.
Environment:
OS: Windows
node: 14.15.3
jest: 26.6.3
C:\Program Files\OpenJDK\jdk-16.0.1\bin\server needs to be in your path. On windows can Edit the system environment > Environment Variables... > System variables and add C:\Program Files\OpenJDK\jdk-16.0.1\bin\server
Other option is to add it to your test runner. For example in WebStorm edit the Run Configurations and add Environment variables PATH=C:\Program Files\OpenJDK\jdk-16.0.1\bin\server
I've been following this guide to setup SSL certificate on my Tomcat server.
https://docs.oracle.com/cd/E29585_01/PlatformServices.61x/security/src/tsec_ssl_jsp_pkcs12.html
When I try to run the .bat file with there mentioned parameters (with my pwd):
-Djavax.net.ssl.keyStoreType=PKCS12
-Djavax.net.ssl.keyStore=%CLIENT_CERT%
-Djavax.net.ssl.keyStorePassword=endeca
-Djavax.net.ssl.trustStore=%CLIENT_CERT%
-Djavax.net.ssl.trustStorePassword=endeca
I get this error at the startup:
Error: Could not find or load main class Files\Java\jre7\lib\security\cert.pkcs12
Any idea what am I doing wrong?
The issue is caused by the space in java installation path C:\Program Files\Java. Install java into a path without spaces will resolve the issue.
Update
Add quotes around the path solve also the issue. Thanks #Ondrej
I'm trying to create my custom C# minecraft launcher but I have this error.
I created a launcher.bat file first in order to solve this problem quicker.
I have this code to start minecraft:
java
-Djava.library.path=C:\Users\Davide\AppData\Roaming\.minecraft\libraries\org\lwjgl\lwjgl\lwjgl-platform\2.9.1\
-cp
C:\Users\Davide\AppData\Roaming\.minecraft\versions\1.7.10\1.7.10.jar;
C:\Users\Davide\AppData\Roaming\.minecraft\libraries\java3d\vecmath\1.3.1\vecmath-1.3.1.jar;
C:\Users\Davide\AppData\Roaming\.minecraft\libraries\net\sf\trove4j\trove4j\3.0.3\trove4j-3.0.3.jar;
C:\Users\Davide\AppData\Roaming\.minecraft\libraries\com\ibm\icu\icu4j-core-mojang\51.2\icu4j-core-mojang-51.2.jar;
C:\Users\Davide\AppData\Roaming\.minecraft\libraries\net\sf\jopt-simple\jopt-simple\4.5\jopt-simple-4.5.jar;
C:\Users\Davide\AppData\Roaming\.minecraft\libraries\com\paulscode\codecjorbis\20101023\codecjorbis-20101023.jar;
C:\Users\Davide\AppData\Roaming\.minecraft\libraries\com\paulscode\codecwav\20101023\codecwav-20101023.jar;
C:\Users\Davide\AppData\Roaming\.minecraft\libraries\com\paulscode\libraryjavasound\20101123\libraryjavasound-20101123.jar;
C:\Users\Davide\AppData\Roaming\.minecraft\libraries\com\paulscode\librarylwjglopenal\20100824\librarylwjglopenal-20100824.jar;
C:\Users\Davide\AppData\Roaming\.minecraft\libraries\com\paulscode\soundsystem\20120107\soundsystem-20120107.jar;
C:\Users\Davide\AppData\Roaming\.minecraft\libraries\io\netty\netty-all\4.0.10.Final\netty-all-4.0.10.Final.jar;
C:\Users\Davide\AppData\Roaming\.minecraft\libraries\com\google\guava\guava\15.0\guava-15.0.jar;
C:\Users\Davide\AppData\Roaming\.minecraft\libraries\org\apache\commons\commons-lang3\3.1\commons-lang3-3.1.jar;
C:\Users\Davide\AppData\Roaming\.minecraft\libraries\commons-io\commons-io\2.4\commons-io-2.4.jar;
C:\Users\Davide\AppData\Roaming\.minecraft\libraries\net\java\jinput\jinput\2.0.5\jinput-2.0.5.jar;
C:\Users\Davide\AppData\Roaming\.minecraft\libraries\net\java\jutils\jutils\1.0.0\jutils-1.0.0.jar;
C:\Users\Davide\AppData\Roaming\.minecraft\libraries\com\google\code\gson\gson\2.2.4\gson-2.2.4.jar;
C:\Users\Davide\AppData\Roaming\.minecraft\libraries\com\mojang\authlib\1.5.21\authlib-1.5.21.jar;
C:\Users\Davide\AppData\Roaming\.minecraft\libraries\org\apache\logging\log4j\log4j-api\2.0-beta9\log4j-api-2.0-beta9.jar;
C:\Users\Davide\AppData\Roaming\.minecraft\libraries\org\apache\logging\log4j\log4j-core\2.0-beta9\log4j-core-2.0-beta9.jar;
C:\Users\Davide\AppData\Roaming\.minecraft\libraries\org\lwjgl\lwjgl\lwjgl\2.9.1\lwjgl-2.9.1.jar;
C:\Users\Davide\AppData\Roaming\.minecraft\libraries\org\lwjgl\lwjgl\lwjgl_util\2.9.1\lwjgl_util-2.9.1.jar;
C:\Users\Davide\AppData\Roaming\.minecraft\libraries\org\lwjgl\lwjgl\lwjgl-platform\2.9.1\lwjgl-platform-2.9.1-natives-windows.jar;
C:\Users\Davide\AppData\Roaming\.minecraft\libraries\net\java\jinput\jinput-platform\2.0.5\jinput-platform-2.0.5-natives-windows.jar;
C:\Users\Davide\AppData\Roaming\.minecraft\libraries\tv\twitch\twitch\5.16\twitch-5.16.jar;
C:\Users\Davide\AppData\Roaming\.minecraft\libraries\tv\twitch\twitch-platform\5.16\twitch-platform-5.16-natives-windows-64.jar;
C:\Users\Davide\AppData\Roaming\.minecraft\libraries\tv\twitch\twitch-external-platform\4.5\twitch-external-platform-4.5-natives-windows-64.jar;
net.minecraft.client.main.Main
--username MYUSERNAME
--accessToken MYACCESSTOKEN
--version 1.7.10
--gameDir C:\Users\Davide\AppData\Roaming\.minecraft
--assetsDir C:\Users\Davide\AppData\Roaming\.minecraft\assets
--userProperties {}
--uuid MYUUID
But when i start it says Exception in thread "main" java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path.
I found on the internet that's a problem of this line
-Djava.library.path=C:\Users\Davide\AppData\Roaming\.minecraft\libraries\org\lwjgl\lwjgl\lwjgl-platform\2.9.1\
But I double checked the path is correct.
Thank you in advance.
EDIT
I solved this problem easily taking out this from the arguments:
-Djava.library.path=C:\Users\Davide\AppData\Roaming\.minecraft\libraries\org\lwjgl\lwjgl\lwjgl-platform\2.9.1\
And putting al the DLL's in the local folder, i can't still access them with the full path though
Ok i found the answer. I had to use the local path and not the absolute one