Trying to run ant - getting error - java

I have just installed ant and JDK 6 and am trying to run an ant task. I get the following:
C:\Users\Giles Roadnight\workspace\Parsley\build>ant compile_spicelib_complete_flex
Buildfile: build.xml
compile_spicelib_complete_flex:
[exec] Error loading: C:\Program Files\Java\jdk1.6.0_17\jre\bin\server\jvm.dll
[exec] Result: 6
BUILD SUCCESSFUL
Total time: 0 seconds
C:\Users\Giles Roadnight\workspace\Parsley\build>
That file - jvm.dll is definitely there. I have tried running as an administrator with the same result.
To install I ran the JDK installer (I already had a JRE installed), I set up JAVA_HOME in my environment variables.
I unzipped ant and added my ant bin directory to my PATH.
I am clueless about Java and how it all works so am a bit lost with this.
I am on 64 bit windows 7. I downloaded a 64 bit JDK.
Any help much appreciated.

you must have Unzipped your flex to some folder. I am referring to this folder as flex_sdk.
Add flex_sdk to the FLEX_HOME environment variable (creating the environment variable if necessary).
Flex compiler needs a 32 bit JRE since there is currently no support for 64 bit JRE. For this, first download a 32 bit(or X86) version of jdk and later have the flex sdk point to it.To do so, you'll need to edit the jvm.config file located in FLEX_HOME\bin. Within jvm.config, set java.home to the location of your 32 bit JDK as shown.(Note that these are not backslashes)
Example: java.home=C:/Program Files (x86)/Java/jdk1.6.0_25 Alternatively, you can also add an environment variable with the name JAVA_HOME and have it point to the above location if you are not able to find the jvm.config file.
/I had the same problem and researched on this for a couple of days. Tried 100s of classpaths and loads of corrupted registry issues. The above solution seemed to work for me. Let me know if it works for you as well/
-Prasad K

It looks to me as if the ant script is running a native program which in turn tries to load the JVM to run some java code, and fails. I would guess that there is a mismatch between 32-bit and 64-bit-ness. The package you are trying to run is, in this theory, using a 32-bit Windows executable which is failing to LoadLibrary the 64-bit JVM DLL.
A simpler possible explanation is that many things in the Java universe get befuddled by spaces on pathnames. Try installing the JDK in a pathname with no embedded spaces.

You can solve this by creating a bat file in the flex-sdk bin directory with the following:
"%JAVA_HOME%\bin\java.exe" -Xmx384m -Dsun.io.useCanonCaches=false -jar "%~dp0\..\lib\mxmlc.jar" +flexlib="%~dp0\..\frameworks" %*
Then invoke this bat file instead of mxmlc.exe
Note: solution found at https://web.archive.org/web/20120327204229/http://sray.squidpower.com/2010/01/13/solution-to-error-running-mxmlcexe-with-windows-64bit-jvm/

The first part that surprises me is that it tries to use the server JVM instead of the regular one, but that might be a feature of your build. The second thing I'd try is to run ant -v instead of plain ant. This should give you a lot more output and hopefully more information as to what ant is trying to do at this point in time.

Related

JPackage Wrong Version (%JAVA_HOME% set to correct directory)

Please help. I'm having issues syncing up my JDK and jpackage versions for creating standalone java programs. The JDK version and the runtime version being included with jpackage are mismatched (JDK16 programs being paired with JDK15 runtimes).
Typing java -version into the command line, it matches up with the current %JAVA_HOME% environment variable configuration, showing JDK16.0.2 (located at C:\Program Files\Java\jdk-16.0.2). This is working correctly.
However the problem becomes more apparent when I type jpackage --version, it reports that it's using JDK15.0.1 - which as far as I know, I've never installed and I'm unsure of where it's running from. This is a problem, since I need to be able to build Java16 programs with jpackage. As it is now, this results incompatible runtimes and JAR files.
I've been googling to no avail. I can't compile my JDK16 programs into installers because it keeps trying to use JDK15.0.1 for the runtime.
For now, I've managed to bypass this strange and seemingly locked configuration by accessing JDK16's jpackage exe manually this way and adding the commands after:
“C:\Program Files\Java\jdk-16.0.2\bin\jpackage.exe”
Any advice is helpful. Perhaps this temporary workaround will be helpful to anyone else with the same problem down the line.
Use the Windows where command to find out what the jpackage command is actually resolving to. It seems clear that jpackage without the full path name is resolving to jpackage in a different installation of Java.
Note that %JAVA_HOME% does not determine how the Windows cmd.exe resolves commands. Command resolution is done according to %PATH%.
The symptoms you describe:
jpackage says %JAVA_HOME% is incorrect but %JAVA_HOME% refers to Java 16
jpackage -version says Java 15 (not Java 16)
"C:\Program Files\Java\jdk-16.0.2\bin\jpackage.exe" works
are all consistent with your %PATH% being incorrect ... and that you do have a Java 15 installation on your machine, and it is on the %PATH% ahead of, or instead of the Java 16 installation you are trying to use.
Note jpackage is no longer an "incubator" tool in Java 16. It has been promoted to full support; see JEP 392: Packaging Tool. So the warnings about incubator mudules are also consistent with jpackage resolving to the wrong Java installation.
This really boils down to understanding what the Windows %PATH% variable is and how it effects the behavior of Windows command shells. (It is analogous to $PATH in Linux, UNIX and Mac OSX command shells.)

Matlab Compiler Runtime installation file cannot locate Java Runtime Environment

A collaborator has sent me some Matlab code which requires an old MCR version (7.14). I have an installation binary from them, but when I run it I am immediately faced with the message
No Java Runtime Environment(JRE) was found on this system
Has anyone experienced this before? I cannot get around the problem. I have JRE installed. I am running Ubuntu 18.04.
Thank you for any help.
One possible cause may be that JAVA_HOME environment variable is not set, or that it is set incorrectly. The variable should point to the installation directory for the JRE / JDK whose java command you are running.
(Note: a correct JAVA_HOME is never a bin directory, so if you have set your $JAVA_HOME to a bin directory you have done it wrong!)
Thus, the solution may simply be to set the JAVA_HOME environment variable (correctly) in your shell before running the MCR installer.
I have used it [the MCR installer] successfully on numerous other Ubuntu machines.
This is suggestive to me that your problem is an incorrect JAVA_HOME ...
Another possible solution would be to follow the instructions in the MATLAB documentation for doing a "non-interactive" install of MCR.
There is apparently a README file in the zip file. It may contain information about command line options for the installer that relate to the version you are using.
Finally, I suspect that the install command is actually a shell script. There may be clues in the script about command line options and other alternatives for installing.

Can't install Java JDK

Ok, this is embarrassing, but I can't install Java. I have no experience in Java so any help appreciated.
So as ussual I install Java JDK (The JRE I think is already there before) I have jre7 and jdk1.8.0.0_05
I have install it, but Java still not in my computer
Here's some desperate cmd check
>C:\>WHERE java
>INFO: Could not find files for the giving pattern
>C:\>java
>'java is not recognized as an internal or external command, operable program or batch file.
Where my java folder is C:\Program Files (x86)\Java\jdk1.8.0.0_5
On my desperation I created the variable JAVA_HOME on the given directory. Afterward, I tried this.
>C:\>echo %JAVA_HOME%
%JAVA_HOME%
I was expecting the cmd to echo the directory.
The variable PATHEXT has the following in it:
.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
Clariffication:
I tried to reinstall the Java Jdk Installer with Windows Installer, but no luck.
If this matters, I'm running from Windows 7.
I tried to learn from Here
After closer inspection, I can run java and javac after going all the way into the directory (so inputing java outside the bin will do nothing good)
Add C:\Program Files (x86)\Java\jdk1.8.0.0_5\bin to your PATH variable
Here is how mine is
I think you may have not added JAVA_HOME environment variable, and/or to PATH environment variable neither.
Give a read to this article
http://www3.ntu.edu.sg/home/ehchua/programming/howto/jdk_howto.html
Regarding you last comment, i think you should put the java directory right infront of all the other directory because, if you were to install another version of java it might not be used if you place it behind.
(For Advanced Users Only)
I suggested that you place the JDK bin directory in front of "c:\windows\system32" and "c:\windows". This is because some Windows systems may have an out-dated copy of JDK/JRE in these directories. Do a search for "java.exe", and you will be amazed by the findings.
You could read "Java Applications and Environment Variable" for more discussions about PATH environment variable.
I also recommend that you define an environment variable called JAVA_HOME, which contains the JDK installed directory, and include the JDK bin directory in the PATH via JAVA_HOME, i.e., PATH=%JAVA_HOME%\bin;.....

Tomcat 7 startup error: tcnative.dll is not valid

I use;
Windows 7 64 bit,
JAVA_HOME= JDK1.7 64 bit,
Tomcat-7 64 bit version
When I start tomcat from commandline it works ok, but when I use it within IntelliJ I get this error;
java.lang.UnsatisfiedLinkError: tcnative-1 (.\tcnative-1.dll is not a valid Win32 application.
I also point to an IBM 32bit JDK1.6 from IntelliJ in project settings, but this could not be a problem since this setup works on some other collegae's computers
I have read similar questions here, but none of them offers a solution for my case, any ideas, how can I fix this?
Here is a link which describes the problem :
Cause:
You get this message when you start Tomcat. Tomcat is looking for a shared object call tcnative (dll or so depending on the platform). If it doesn't find it, it'll revert to java libs. Either way, this shouldn't affect your application. tcnative dll is needed to address scalability in Tomcat.
Solution:
Turn down debugging level for Tomcat or
Get tcnative from http://tomcat.apache.org/native-doc/ (windows users can download the binary) and place it in your library path.
Lib path is usually: C:\Program Files\Apache Software Foundation{Apache Tomcat directory}\lib; for windows
Basically It seems that you may have an incorrect version.
Are you using multiple java on your machines if yes then try to look into environment variables for JAVA_HOME & PATH. Secondly, also paste the complete version of java and tomcat
Also run following commands at command prompt
java -version
javac -version
echo %JAVA_HOME%
And are you using MSI installer of tomcat or just a zip version of tomcat. Because in many cases MSI installer never work for some ghost reasons.

Run eclipse on windows 7 64 bit

I'm trying to run eclipse for java in Windows 7 64bit edition, and when I run the eclipse.exe file, absolutely nothing happens. A ephimeral javaw.exe process is created in the task manager, but as I said, it's just there for a split second, and it disappears, after that NOTHING. I tried compiling a small program with the javac.exe file, and that works all right, but for some reason I cannot run Eclipse.
Any suggestions on what I could be doing wrong. I'm a complete Java noob, it's the first time I try to do this.
These are the files I have, and I downloaded the Windows 64bit version of eclipse.
Thanks!
EDIT
OK, solved. The book I'm using is misleading... it said I should use the javaw.exe file from jdk1.6.0_21, and doing that didn't work. Now I tried with one in jre6, and it ran.
Thanks everyone and sorry for the hassle!
First, check you eclipse.ini (even a space at the end of a line can prevent eclipse from starting)
Second I am surprised to see java* file in your Eclipse distribution.
You shouldn't' have those, and instead refer to the right java (64 bits) in your eclipse.ini.
In both case, see this eclipse.ini as a good example.
Check also the <workspace>/.metadata/.log (error log file).
I just added it there because it was asking for it, supposedly the best way it to put it in the PATH.
If eclipse is "asking for it", that means your current java installation is not part of the PATH. It need to be reference from the eclipse.ini file.
See also FAQ How do I run Eclipse?
In any event, don't copy any java files around.
Used in your eclipse.ini a path like:
-vm
C:/Prog/Java/jdk1.6.0_21/jre/bin/server/jvm.dll
Do you have the 64-bit version of Java? http://www.java.com/en/download/faq/java_win64bit.xml
I experienced relatively little trouble moving to 64-bit java:
Download Eclipse Helios 64-bit version
Download Java 6 SDK 64-bit version
Install both
Run
The issues may arise if you have both 32-bit and 64-bit JDKs in the same machine. If you want to explicitly run Eclipse with one JVM, then you need to specify its full path in eclipse.ini.
e.g.
-vm
C:/Program Files/Java/jdk1.6.0_20/bin/javaw.exe
Where the path points to the 64-bit version.
The other issue I encountered after moving is that the Subclipse plugin by default uses a 32-bit DLL backend and therefore doesn't work. However Subclipse also works with a pure-Java back-end for Eclipse called JavaHL which solved that issue.
I faced similar problem and did not know how to proceed.
I did following things to resolve it.
In eclipse.ini enter the vm argument to which jre you want to use
-vm
C:\Java\jdk1.7\jre\bin\javaw.exe
If you have -Dosgi.requiredJavaVersion=1.7 line in your eclipse
make sure that version is matching the one that is mentione in step 1.
( in my case it was 1.6 and I had to change this value to 1.7)
Launch eclipse.exe from the command line

Categories