How can I overcome error messages at Maven Initialization time? - maven-3

Today I downloaded apache-maven-3.0.5 and Installed through the following link Link
after installing, I run the following command for checking whether it's installed or not
mvn -version
it showing message like this.
C:\Users\Infratab Bangalore>mvn -version
Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 19:21:
28+0530)
Maven home: P:\Software\apache-maven-3.0.5
Java version: 1.7.0_21, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.7.0_21\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "x86", family: "windows"
'cmd' is not recognized as an internal or external command,
operable program or batch file.
If you observe above message,I am getting one error, clearly I mentioned error in below
'cmd' is not recognized as an internal or external command,
operable program or batch file.
How can I overcome this.

Finally I got it,why I am getting this problem 'cmd' is not recognized as an internal or external command, operable program or batch file. Because the following path C:\Windows\System32 was not set in Environment variables. I found through google.I fix it.run same command again it doesn't show any error.

Related

Probable bug in java compiler for openjdk8, how to report and get it fixed?

I've prepared docker image that demonstrate the problem:
https://drive.google.com/uc?id=1i04_dVL0Rp5rxXCMuHaS4LYREkZjAAW1&export=download
This image is basically alpine:3.11 + apk add openjdk8 maven + my maven project containing sample minimal java class that shows problem
Which you can try with following commands:
# docker load -i bugexample.img
# docker run -w /root/bug-example --name bugtest bugexample /bin/ash build-until-sha-different.sh
If you are lucky enough (sometimes require several attempts) you will get following output:
Found! Sha1 of two subsequent otherwise identical builds are different!
--- 1.sha1
+++ 2.sha1
## -1,3 +1,3 ##
d8d46555c93da579adefc629f1764965a5493edb com/SimpleBug$1.class
75007242aab1e1877d24124d432cb246a79476a8 com/SimpleBug$SimpleBugBuilder.class
-23e8d0ea909b95a7955e0ec0adb4d12ae2193dd1 com/SimpleBug.class
+6a303d69d3f382b23ca04caee4102ee1cd7151e3 com/SimpleBug.class
The core issue with this build is that it produce different bytecode almost each time it get build even though nothing else (neither environment, nor code itself) had changed.
When I do compare these different class files I see that they differ in one single byte:
# cmp -lb 1_SimpleBug.class 2_SimpleBug.class
4053 66 6 65 5
Digging deeper into class file structure I've found that this difference come from stackmapframe constant pool pointers (StackMapTable attribute -> stack_map_frame entry with tag Object_variable_info -> cpool_index)
1_SimpleBug.class
#35 = Utf8 supSetStringParameter10
#36 = Utf8 Lcom/google/common/base/Supplier;
2_SimpleBug.class
#35 = Utf8 supSetStringParameter10
#36 = Utf8 Lcom/google/common/base/Supplier;
So one file points to #35 and another to #36. I don't think this is correct behavior.
I would like to sumbit this to a proper issue tracker but I don't know how to do that since all related JDK trackers are for devs only.
# java -version
openjdk version "1.8.0_242"
OpenJDK Runtime Environment (IcedTea 3.15.0) (Alpine 8.242.08-r0)
OpenJDK 64-Bit Server VM (build 25.242-b08, mixed mode)
# mvn -version
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /usr/share/java/maven-3
Java version: 1.8.0_242, vendor: IcedTea, runtime: /usr/lib/jvm/java-1.8-openjdk/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.15.0-1050-kvm", arch: "amd64", family: "unix"
And here is archive with java project:
https://drive.google.com/uc?id=1ZBdRzUk00QtpkGGnKAzipMjMtcnkKGN4&export=download
Well... The Mountain in Labour...
All of this was for nothing. Maven was main culprit. First time I ran my build it downloads lots of stuff that maven require (apart from my project dependencies) and then start compilation in same jvm. Second time build runs there is no need to download so compilation starts immediately. I don't know exactly why but first invocation of compiler is somehow affected by state of the jvm and this cause it to produce slightly different bytecode.
Solution was to add <fork>true<fork> to my pom.xml file and build now is totally reproducible... though takes ~2x more time :)
I still believe that this should not happen even if initial compilation happened inside maven jvm, and it may still be topic for improvement in javac but this "workaround" is acceptable.

mvn archetype:create SHA-256 MessageDigest not available

This is my first time to try maven. My os in linuxmint.I have install maven successful.
mvn -v
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-11T00:41:47+08:00)
Maven home: /home/gzx/danale/environment/apache-maven-3.3.9
Java version: 1.8.0_111, vendor: Oracle Corporation
Java home: /usr/java/jdk1.8.0_111/jre
Default locale: zh_CN, platform encoding: UTF-8
OS name: "linux", version: "4.4.0-53-generic", arch: "amd64", family: "unix"
But when I have used mvn archetype:create
mvn archetype:create -DgroupId=org.sonatype.mavenbook.ch03 -DartifactId=simple -DpackageName=org.sonatype.mavenbook
it showed a strange error.
[WARNING] Error injecting: org.sonatype.plexus.components.cipher.DefaultPlexusCipher
com.google.inject.ProvisionException: Unable to provision, see the following errors:Error injecting constructor, org.sonatype.plexus.components.cipher.PlexusCipherException: java.security.NoSuchAlgorithmException: SHA-256 MessageDigest not available
at org.sonatype.plexus.components.cipher.DefaultPlexusCipher.(Unknown Source)
while locating org.sonatype.plexus.components.cipher.DefaultPlexusCipher
It was so strange, how should I do?
I think maybe you have already figured your problem. But I got this bug yesterday and I fixed it today. I should write my solution down. Maybe someone will fall this trap.
Actually this problem is because Java cannot find the class "SHA-256 MessageDigest". But it is provided by JRE default. It should be found automatically.
If you access your JAVA_HOME, you may find a file whose name is jsse.pack in JAVA_HOME/jre/lib, and there is not a file named jsse.jar. That is the problem. Type
unpack200 jsse.pack jsse.jar
(unpack200 will be recognized as soon as you have set your Java path)
and the problem should be soloved.
Note:
Some JDK's have jsse.rar not jsse.pack, therefore, running "unpack200 jsse.rar jsse.jar" command will get the desired result, and will not delete the "jsse.rar" file (in case of *.pack files, they get replaced by the *.jar files).

Not a valid Windows application error in PHPStorm file watcher

Here's what I get in my CMD:
C:\Documents and Settings\Administrator>lessc
lessc: no input files
... (long program output)
C:\Documents and Settings\Administrator>"C:\Documents and Settings\Administrator
\Dane aplikacji\npm\lessc"
lessc: no input files
usage: lessc [option option=parameter ...] <source> [destination]
... (long program output)
C:\Documents and Settings\Administrator>
But when I add a file watcher in my PHPStorm for LESS and specify the program to:
C:\Documents and Settings\Administrator\Dane aplikacji\npm\lessc, I get the following error:
16:52:38 An exception occurred while executing watcher 'LESS'. Watcher has been disabled. Fix it.: Cannot run program "C:\Documents and Settings\Administrator\Dane aplikacji\npm\lessc" (in directory "C:\Documents and Settings\Administrator\Pulpit\bootstrap\css"): CreateProcess error=193, %1 nie jest prawid³ow¹ aplikacj¹ systemu Wi
Why is this happening and how can I fix this?
You seems to forgot how Windows/DOS works ;)
When you trying to execute lessc in Command Shell, Windows will search for such file. If nothing found -- it will search for lessc.exe, lessc.com, lessc.bat, lessc.cmd and so on -- depends on value of PATHEXT environment variable. Just type SET in command prompt and see for yourself.
In PhpStorm (or any other software) where NO command shell is used but command executed DIRECTLY, you have to specify FULL program name, which is lessc.cmd

Unable to run the demo setup

I have downloaded the Activity 5.10 zip file and then i have downloaded and configured the Apache ANT and i test it and it worked successfully.
But i am unable to run the demo file as specified in this link http://activiti.org/userguide/#demo.setup
if i type the following using the cmd command line:-
C:\activiti-5.10\activiti-5.10\setup>ant demo.start
I will get the following error:-
'ant' is not recognized as an internal or external command, operable program or batch file.
Can anyone help me in identifying what is the problem?
BR
:::UPDATE:::
thanks for the reply, i have copied the ANT bin files inside the setup directory for the activity,, then i run the CMD command again ,, but i got the following error that i build failed,,
AS MENTIONED BELOW:-
C:\Users\Desktop\activiti-5.10\activiti-5.10\setup>ant demo.start
Buildfile: C:\Users\Desktop\activiti-5.10\activiti-5.10\setup\build.xml
demo.install:
internal.cfg.create:
[copy] Copying 1 file to C:\Users\Desktop\activiti-5.10\activiti-5.
10\setup\build\activiti-cfg
[zip] Building zip: C:\Users\Desktop\activiti-5.10\activiti-5.10\s
etup\build\activiti-cfg.jar
[echo] copying configuration to ../workspace/activiti-engine-examples/src/m
ain/config
[unzip] Expanding: C:\Users\Desktop\activiti-5.10\activiti-5.10\setu
p\build\activiti-cfg.jar into C:\Users\Desktop\activiti-5.10\activiti-5.
10\workspace\activiti-engine-examples\src\main\config
internal.classpath.libs:
internal.taskdef.launch:
h2.start:
[echo] starting H2 database...
[launch] launching cmd 'C:\Users\Desktop\activiti-5.10\activiti-5.10\
apps\h2\h2.start.bat ' in dir 'C:\Users\Desktop\activiti-5.10\activiti-5
.10\apps\h2'
[launch] waiting for launch completion msg 'TCP server running'...
[launch] 'java' is not recognized as an internal or external command,
[launch] operable program or batch file.
[launch] launched process completed
[echo] H2 database started
tomcat.start:
BUILD FAILED
C:\Users\Desktop\activiti-5.10\activiti-5.10\setup\build.xml:330: couldn
't find executable for script C:\Users\Desktop\activiti-5.10\activiti-5.
10\apps\apache-tomcat-6.0.32\bin\startup
Total time: 0 seconds
Looks like you didn't set the ant directory in you path variable. Either specifiy the entire path to ant or add it to the path variable
I typed tomcat.install and it solved the problem since I need to download the tomcat inside the apps directory.

Phonegap and Blackberry WebWorks: build\StandardInstall does not exist

My environment is Windows XP.
JDK and Apache ant are installed.
Phonegap version is 1.7.0
BlackBerry Webworks SDK for smartphone: version 2.3.1
I'm following the instruction of http://docs.phonegap.com/en/1.7.0/guide_getting-started_blackberry_index.md.html#Getting%20Started%20with%20Blackberry to try phonegap on blackberry.
The sample Blackberry WebWorks sample application I use is this https://github.com/phonegap/phonegap/tree/master/lib/blackberry/sample
First I execute 'ant blackberry build'. Although it said "BUILD SUCCESSFUL", however, neither StandardInstall nor .cod was created. And the output contained error message like this:
[exec] E:\Temp\widgetGen.15924526831337325595265.tmp\extension\blackberry\common\util\URLDecoder.java:183: unclosed string literal
[exec] decodingMap.put( "%AC", "? );
[exec] ^
[exec] 100 errors
[exec] Error!: Error: java compiler failed: C:\Program Files\Java\jdk1.6.0_32\bin\javac.exe #E:\TEMP\rapc_02802fef.dir\options
[exec] [ERROR] RAPC exception occurred
The full build log is here http://www.cis.nctu.edu.tw/~gis90571/a.txt
Then I execute 'ant blackberry load-simulator', it shows:
...
BUILD FAILED
D:\WebWorks_projects\helloworld\build.xml:33: The following error occurred while
executing this line:
D:\WebWorks_projects\helloworld\blackberry.xml:123: D:\WebWorks_projects\hellowo
rld\build\StandardInstall does not exist.
the content of blackberry.xml is:
123: <copy todir="${simulator.dir}">
124: <fileset dir="${build.dir}/StandardInstall" includes="*.cod, *.cso, *.csl, *.alx" />
125: </copy>
(I put the sample app provided by phonegap in D:\WebWorks_projects and changed its name to "helloworld".)
I'm new to ant and blackberry.
Could someone please offer some help or hint? Thanks.
Answer:
It seems that the source file URLDecoder.java in \ext\common\blackberry\common\util is broken due to some encoding issue. Fix it and the problem solved.
An useful article here: http://whatdrewknows.blogspot.com/2012/04/cordova-blackberry-development-part-2.html
Your application is not successfully getting built.
If your application gets build and generate 3 folders
OTAInstall
StandardInstall
widget
As well as one application.zip file is also created.
If you get all these files then your application was successfully compiled and built.

Resources