Error while installing Maven on windows 7 - maven

So following the instructions found here http://www.mkyong.com/maven/how-to-install-maven-in-windows/ I attempted to set up Maven on a windows 7 environment. Problem is when I ever I run mvn --version or any command with mvn for that matter I get an error saying:
Error: Could not find or load main class org.codehaus.plexus.classwords.launcher.Launcher
Any ideas as to what might be causing this and how to fix it?

If you take a look to the doc you can read this:
Why do I get java.lang.NoClassDefFoundError: org/codehaus/classworlds/Launcher when I try to execute Maven?
This sometimes happens when $M2_HOME is not the same as your $PATH. That is, when 'which mvn' does not match $M2_HOME/bin/mvn.

Related

Ruby: How to fix PATH error in Atom Runner?

When trying to run Atom Runner, I'm getting the following error:
Unable to find command: ruby
Are you sure PATH is configured correctly?
I've followed the troubleshooting advice and added a PATH environment variable and restarted my PC but looks like it's incorrect.
This is what I tried adding:
%HOME%\myusername.rbenv\versions\3.1.0\lib\ruby\
%HOME%\myusername.rbenv\
What else can I try?

having trouble running gradle

I typed in the command gradle -q run into the command prompt and I got the response
"Execution failed for task ':compileJava'.
Could not find tools.jar. Please check that C:\Program Files\Java\jre1.8.0_161 contains a valid JDK installation."
I don't understand what this means.
The error is basically saying that it can't find the JDK.
To fix the problem, you need to update/create your "JAVA_HOME" system variable to point to a valid JDK. Your problem may be that you haven't created that system variable.
Here are some instructions for how to do this in Windows.

Why does executing debug in 0.13.7 fail with "Could not find agent library jdwp:transport on the library path"?

After update from 0.13.6 to 0.13.7 I cannot debug with SBT.
It is installed using Homebrew. I tried to reinstall it, brew doctor shows nothing.
I did not change/reinstall Java between SBT update.
lgr$ sbt -v -jvm-debug 5005 "project webapp" run
[process_args] java_version = '1.8.0_25'
# Executing command line:
java
-Xms1024m
-Xmx1024m
-XX:ReservedCodeCacheSize=128m
-XX:MaxMetaspaceSize=256m
-agentlib:jdwp:transport=dt_socket,server=y,suspend=n,address=5005
-jar
/usr/local/Cellar/sbt/0.13.7/libexec/sbt-launch.jar
"project webapp"
run
Error occurred during initialization of VM
Could not find agent library jdwp:transport on the library path, with error: dlopen(libjdwp:transport.dylib, 1): image not found
I am unsure whether SBT is missing some library, or brew formula didn't install properly.
I will be helpful for any idea how to fix it.
Reinstalled Java, didn't help.
Workaround I downloaded SBT 0.13.6 and it works without problem, so I start to consider this as a sbt bug. Can anyone help to clarify if it is?
To piggyback on Eugene's answer above, since the fix is in a bash script, it is pretty easy to apply the fix from https://github.com/sbt/sbt-launcher-package/pull/85/files manually. Just edit bin/sbt-launch-lib.bash to have this:
addJava "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=$1"
Instead of this:
addJava "-agentlib:jdwp:transport=dt_socket,server=y,suspend=n,address=$1"
(Mind the : not = between jdwp and transport).
It is installed using Homebrew.
Homebrew install is sanctioned by sbt project as a recommended way to install on Mac, but we (I'm one of the sbt devs) currently don't control it. We do however have the official package sbt/sbt-launcher-package, and last I checked Homebrew is also using it.
Looking at git blame of the relevant part of the script, it seems like the debug option was "fixed" in sbt/sbt-launcher-package#83:
In sbt-launch-lib.bash, -Xdebug option is used for debugging. We should use -agentlib option for Java 5+.
Maybe your issue should be tracked as a bug in sbt/sbt-launcher-package.
The problem was fixed in the 0.13.8 version.
At my case the bash fix didn't help but running from bash as:
export SBT_OPTS="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005"
sbt
helped. It is from here.

Trying to run hadoop on windows

I am trying to run hadoop in my machine (Windows x64), but I get this error when building the sources:
[ERROR] Failed to execute goal org.apache.hadoop:hadoop-maven-plugins:2.3.0:protoc (compile-protoc) on project hadoop-common: org.apache.maven.plugin.MojoExecutionExcepti
on: 'protoc --version' did not return a version -> [Help 1]
As suggested in the documentation and explained in the BUILDING.txt, I have in my PATH vble the protoc path and from my Windows SDK I can call 'protoc --version' with no problem:
C:\Users\hernanbl\Downloads\hadoop-2.3.0-src\hadoop-common-project>protoc --version
libprotoc 2.5.0
Besides, the version is the same as used in hadoop 2.3.0 (the version I am trying to build). As defined in the documentation, I made further changes, such as declaring a Platform vble and so on.
I already googled the question and I found that I might not be the only one having this issue, but the answers don´t give me the clue to fix this...
Some ideas?? Thanks!!
I solved it by setting the environment variable pointing to the executable:
set HADOOP_PROTOC_PATH=C:\Path\To\protoc\protoc.exe
I got it.... still a solution I don´t like at all! If someone found a better one, please let me know:
Modify the class ProtocMojo, hardcoding the absolute path to the protoc.exe:
protocCommand= "C:\\development\\tools\\protoc\\protobuf-2.5.0\\src\\protoc.exe";

How to install maven?

I had install maven3 on another computer without problem few days ago, but I don't understand this problem.
(I have read the http://maven.apache.org/download.cgi to install maven, follow the instructions)
My M2_HOME is : C:\maven\apache-maven-3.0.5
My JAVA_HOME is : C:\Program Files\Java\jdk1.7.0_10
My PATH : C:\Ruby193\bin;C:\devkit;C:\devkit\ansi\x64;C:\Ruby193\include\ruby-1.9.1;%M2_HOME%\bin;%JAVA_HOME%\bin
Each folder contain the program it should include.
But when I launch mvn --version in a new console, nothing happen. I have to kill my console because I can't do anything in it. (I waited for 3 minutes without results, just in case)
And so with all maven command.
Edit : Thanks to baba, a new info :)
The problem is only with Mingw. It works with a classical dos console.
You don't need ruby to have maven. You, however, need java.
On another note, try to go to where the binary of maven is:
as in:
C:\maven\apache-maven-3.0.5\bin
then execute mvn --version. Also, if it doesn't work, try manually calling mvn.bat (which should be there for a Windows installation) with --version argument. If it still doesn't work, something is wrong with your maven installation, and we can go from there.
But if it works, then it is a path issue.

Resources