Apache Groa could not find main class error - java

When I try to run apache gora compiler using ./gora goracompiler, I m getting the following error
Error: Could not find or load main class org.apache.gora.compiler.cli.GoraCompilerCLI
Before that I got JAVA_HOME not set error after that I resolved that error by setting JAVA_HOME variable
OS: Cent OS 6.5
Java version : java version "1.7.0_45"
OpenJDK Runtime Environment (rhel-2.4.3.3.el6-x86_64 u45-b15)
OpenJDK 64-Bit Server VM (build 24.45-b08, mixed mode)

goracompiler command expects GoraCompilerCLI to be in $GORA_HOME/gora-compiler-cli/target/classes/
Check you have gora-compiler-cli/target/classes/java/org/apache/gora/compiler/cli/GoraCompilerCLI.class or the .jar from the module gora-compiler-cli in the classpath.
If not, compile the module with:
mvn package -pl gora-compiler-cli

Related

Trying to install rJava but error says JDK is incomplete

I'm using install.packages('rJava', type='source')to install rJava, but it presents with the following error:
configure: error: one or more Java tools are missing.
*** JDK is incomplete! Please make sure you have a complete JDK. JRE is not sufficient.
configure: error: ./configure failed for jri
ERROR: configuration failed for package ‘rJava’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/rJava’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/rJava’
Warning in install.packages :
installation of package ‘rJava’ had non-zero exit status
I just installed JDK8 so I'm not sure what's going on.
javac -version throws javac 1.8.0_231
java -version throws 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)
This guy at R: rJava package install failing came up with a solution that I don't even understand since I'm new to this, but it has something to do with PATH and JAVA_HOMEand /jre apparently.
Looks like JAVA_HOME points to a JRE, not the JDK you want and need. Have a look at the top voted answer to "What should I set JAVA_HOME to on OS X". Also see https://developer.apple.com/library/archive/qa/qa1170/_index.html

Mac only: Could not find or load main class

I have a jar file of my application.
When i run it using java -cp "jarfile.jar" com.my.MainClass it works just fine but if i give it to other devs, there is a clear case where i get this error:
Error: Could not find or load main class com.my.MainClass
Caused by: java.lang.ClassNotFoundException: com.my.MainClass
It is as such, only not working on Mac's. (Windows is fine)
Mac java version:
openjdk version “11.0.2” 2019-01-15
OpenJDK Runtime Environment 18.9 (build 11.0.2+9)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.2+9, mixed mode)
Windows java version:
openjdk version "11" 2018-09-25
OpenJDK Runtime Environment 18.9 (build 11+28)
OpenJDK 64-Bit Server VM 18.9 (build 11+28, mixed mode)
I do not have any sun.* dependencies. Only finding dependencies under java.util, java.net, java.io, java.nioorg.junit (which is bundled in jar).
Will gladly give more info if necessary, just have no idea what is missing as such.
can you try this and ensure that you must be in parent folder of com directory
from your question MainClass is in following package hierarchy com->my->MainClass.java
and your class file MainClass.class also will present in same package hierarchy.
while running this MainClass you must be in parent directory of your com folder and try the following command for compile or run
in windows:-
for compile (ensure that you executing this command in parent folder for com directory)
javac -cp "jarfile.jar;." com\my\MainClass.java
java -cp "jarfile.jar;." com.my.MainClass
for Mac or linux (ensure that you executing this command in parent folder for com directory)
javac -cp "jarfile.jar:." com/my/MainClass.java
java -cp "jarfile.jar:." com.my.MainClass

Java Home not define (wso2ei-6.4.0 installation)

I am trying to install wso2ei-6.4.0, but it will not run due to the following error messages. I am running a RPi with Debian
Error: JAVA_HOME is not defined correctly.
CARBON cannot execute java
I have executed Java -verison and have the following return
java version "1.8.0_65"
Java(TM) SE Runtime Environment (build 1.8.0_65-b17)
Java HotSpot(TM) Client VM (build 25.65-b01, mixed mode)
I know the java directory, using Java -which
/usr/bin/java
How do I run Java from any of the directory to execute the installation of wso2ei-6.4.0?
After some time and reading, I managed to add the following into ~/.bashrc:
export JAVA_HOME="/usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt"
export PATH=$PATH:$JAVA_HOME/bin
Note the arm32 directory for the jdk
Try this (as root user):
export JAVA_HOME=/usr/bin/java
Does this solve your issue?

AWS Codedeploy fails with JAVA_HOME error

Have installed java 8 and
Java -version
yields
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)
Having a AfterInstall script under hooks which simply has
cd $HOME/workspace
mvn clean install
AWS codedeploy is failing with following error
{\"message\":\"Script at specified location: scripts/start failed with exit code 1\",\"log\":\"LifecycleEvent - AfterInstall\\nScript - scripts/start\\n[stderr]Error: JAVA_HOME is not defined correctly.\\n[stderr] We cannot execute /usr/lib/jvm/jre/bin/java\\n\"}"}
echo $JAVA_HOME gives
/usr/java/jdk1.8.0_45/jre
Have also tried setting JAVA_HOME to
/usr/java/jdk1.8.0_45
When i try mvn clean install directly in the workspace it was able to pickup the Java correctly. Any idea what went wrong in code deploy?
hooks:
BeforeInstall:
- location: scripts/pre_processing
AfterInstall:
- location: scripts/start
Codedeploy seems works fine, it just run whatever script you gave.
This could be a problem of JAVA_HOME not accessible by current running user.
If you don't specify the runas parameter inside the appSpec, the scripts will run under root privilege by default(since the host agent starts with root privilege).
If this is the case, the possible workaround is either make JAVA_HOME accessible by root, or specify runas inside the appSpec for the AfterInstall script.

Error: java/lang/NoClassDefFoundError: java/lang/Object

I am using Linux Ubuntu 13.10
I am trying to run a script and get the following error:
/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/rt.jar: Success
Error occurred during initialization of VM
java/lang/NoClassDefFoundError: java/lang/Object
I have:
javac -version
javac 1.7.0_51
java -version
java version "1.7.0_51"
OpenJDK Runtime Environment (IcedTea 2.4.4) (7u51-2.4.4-0ubuntu0.13.10.1)
OpenJDK 64-Bit Server VM (build 24.45-b08, mixed mode)
When I run:
echo $CLASSPATH: I get blank output
echo $JAVA_HOME: blank output
Please help me, how to resolve this.
You have to set your CLASSPATH and JAVA_HOME environment variables. Take a look at this:
https://askubuntu.com/questions/186693/how-set-classpath-variable-for-a-folder-in-ubuntu
http://www.wikihow.com/Set-Up-Your-Java_Home-Path-in-Ubuntu
This could be useful as example, replacing the directories by yours:
export JAVA_HOME="/usr/lib/jvm/java-7-openjdk-i386/bin"
export CLASSPATH=".:/usr/lib/jvm/java-7-openjdk-i386/lib"
After you compile your code, you end up with .class files for each class in your program. These binary files are the bytecode that Java interprets to execute your program. The NoClassDefFoundError indicates that the classloader, which is responsible for dynamically loading classes, cannot find the .class file for the class that you're trying to use. It probably indicates that you haven't set the classpath option when executing your code. This link explains how to set the classpath when you execute

Categories

Resources