Unable to find file associated with ANT (mac) - java

I recently installed ANT and I am unable to build due to a file not being found.
What I have done so far:
1) Installed ANT 1.9.2 via macports
When I type ant into terminal I get an output "Buildfile: build.xml does not exist!
Build failed". When I type ant -version I get "Apache Ant(TM) version 1.9.2 compiled on July 8 2013".
So it looks like ANT is installed.
2) Added paths for ANT_HOME and JAVA_HOME in Users/<"myName">/.bash_profile
export ANT_HOME=/usr/local/ant
export PATH=${PATH}:${ANT_HOME}/bin
export JAVA_HOME=$(/usr/libexec/java_home)
Did I do this correctly?
Now when I attempt to execute a file (java file with .xml), I get this output:
-bash-3.2$ ant execute
Buildfile: /Users/<"myName">/Desktop/CST420:SER321/Assign0/src/javaFraction/JavaFraction/build.xml
BUILD FAILED
/Users/<"myName">/Desktop/CST420:/Users/<"myName">/Desktop/CST420:SER321/Assign0/src/javaFraction/JavaFraction/build.xml:8: The following error occurred while executing this line:
java.io.FileNotFoundException: /Users/<"myName">/Desktop/CST420:/usr/local/ant/lib/ant.jar (No such file or directory)
at java.io.RandomAccessFile.open(Native Method)
at java.io.RandomAccessFile.(RandomAccessFile.java:216)
at org.apache.tools.zip.ZipFile.(ZipFile.java:211)
at org.apache.tools.zip.ZipFile.(ZipFile.java:176)
at org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:255)
at org.apache.tools.ant.helper.ProjectHelper2.parseUnknownElement(ProjectHelper2.java:130)
at org.apache.tools.ant.helper.ProjectHelper2.parseAntlibDescriptor(ProjectHelper2.java:110)
at org.apache.tools.ant.taskdefs.Antlib.createAntlib(Antlib.java:91)
at org.apache.tools.ant.taskdefs.Definer.loadAntlib(Definer.java:425)
at org.apache.tools.ant.taskdefs.Definer.execute(Definer.java:277)
at org.apache.tools.ant.ComponentHelper.checkNamespace(ComponentHelper.java:874)
at org.apache.tools.ant.ComponentHelper.getDefinition(ComponentHelper.java:307)
at org.apache.tools.ant.ComponentHelper.createComponent(ComponentHelper.java:284)
at org.apache.tools.ant.ComponentHelper.createComponent(ComponentHelper.java:263)
at org.apache.tools.ant.UnknownElement.makeObject(UnknownElement.java:429)
at org.apache.tools.ant.UnknownElement.maybeConfigure(UnknownElement.java:163)
at org.apache.tools.ant.Task.perform(Task.java:347)
at org.apache.tools.ant.Target.execute(Target.java:435)
at org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:179)
at org.apache.tools.ant.ProjectHelper.configureProject(ProjectHelper.java:93)
at org.apache.tools.ant.Main.runBuild(Main.java:826)
at org.apache.tools.ant.Main.startAnt(Main.java:235)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
Total time: 0 seconds
What can I do to remedy this?
Also, I seem to be stuck in the -bash-3.2 shell in my terminal (not sure if this has anything to do with the current issue). Would anyone know how I can get back to the login shell (where is displays the current directory instead of bash)?

Did you check if the file /Users/<"myName">/Desktop/CST420:/usr/local/ant/lib/ant.jar exists.
run this
ls -l /Users/<"myName">/Desktop/CST420:/usr/local/ant/lib/ant.jar
See what happens,
For the second question, try to press ctrl + d.

Related

Cannot open sever.jar file

So I was trying to make a 1.17.1 minecraft server on my mac. I couldn't open my 1.17.1_server.jar with Java 8 so I download Java 16.0.2.
Unfortunately, everytime I was opening the 1.17.1_server.jar file, I got
"The Java JAR file "1.17._server.jar" could not be launched." .
I first thought that it was because the file was launch by Java 8 instead of 16.
So I went into the terminal and run :<path to java> -jar 1.17.1_server.jar
I then got this : Error: Unable to access jarfile 1.17.1_server.jar
Finally i tried to put the path of the jar file in the command...
So I've run : path to java -jar path to server
and got this :
[main/ERROR]: Failed to load properties from file: server.properties
[15:57:35] [main/WARN]: Failed to load eula.txt
[15:57:35] [main/INFO]: You need to agree to the EULA in order to run the server. Go to eula.txt for more info.
So why I have to agreed Eula if i've never launched it ? Does it think that he already been launched ?
As stated in the error message
[15:57:35] [main/INFO]: You need to agree to the EULA in order to run the server. Go to eula.txt for more info.
You have to open the file and check yes
Okay find the solution: my eula and server properties file were in my user folder dk why (never moved them so...)

BUILD FAILED: Attempt to copy file to [path]. Java (netbeans)

I'm tired of searching for answers, my problem is:
I want to create an executable file, I am working on a large program, and I encounter this problem, I did not find a solution, I created a new program to look for the problem, the new program does not have any code, just a line in order to show 'Hello Word' and added a picture in another package, And again encountered the same problem:
ant -f 'MyPath'\\New -Dnb.internal.action.name=rebuild clean jar
init:
deps-clean:
Updating property file: 'MyPath'\New\build\built-clean.properties
Deleting directory 'MyPath'\New\build
clean:
init:
deps-jar:
Created dir: 'MyPath'\New\build
Updating property file: 'MyPath'\New\build\built-jar.properties
Created dir: 'MyPath'\New\build\classes
Created dir: 'MyPath'\New\build\empty
Created dir: 'MyPath'\New\build\generated-sources\ap-source-output
Compiling 1 source file to 'MyPath'\New\build\classes
Copying 1 file to 'MyPath'\New\build\classes
Attempt to copy 'MyPath'\New\src\pic\1.png to 'MyPath'\New\build\classes\pic\1.png using NIO Channels failed due to 'MyPath'\New\build\classes\pic\1.png (Accès refusé)'. Falling back to streams.
'MyPath'\New\nbproject\build-impl.xml:931: Failed to copy 'MyPath'\New\src\pic\1.png to 'MyPath'\New\build\classes\pic\1.png due to java.io.FileNotFoundException 'MyPath'\New\build\classes\pic\1.png (Accès refusé)
BUILD FAILED (total time: 2 seconds)
I'm using Netbeans IDE 8.2 , Sys : Windows 10.
It's a file/folder permissions problem. Your user does not have the rights to make changes to certain files/folders involved in the build process, so neither does Netbeans. You can validate this by running that ant command as root through the command line - it should suddenly work.
I solved the problem on mac by changing the group permissions for the parent folder listed in the error message and adding my user to said group.
I'm not an expert when it comes to permissions on Windows, so I shouldn't try to tell you how to do the same there, but you could reference something like this - https://www.online-tech-tips.com/computer-tips/set-file-folder-permissions-windows/ - for help in achieving the same thing.

Jenkins windows ssh slave access denied

I want to build my projects on a Windows machine, so I created a slave there. First we tried the standard java application runner, but our build sets up its own environment and it always ended up deleting the existing Java installation, not giving any proper error messages, but failing. Then I switched to using Cygwin sshd and have Jenkins log in via ssh. This works for the connection (just as the standard method worked), but when I ran the build then it failed again to install the jdk. I ended up running the following command by hand:
C:\jenkins\tools\hudson.model.JDK\Latest\jdk.exe ADDLOCAL="ToolsFeature" REBOOT=ReallySuppress INSTALLDIR=C:\jenkins\tools\hudson.model.JDK\Latest /L
This is the same as Jenkins would run, but without the /s (silent) option. Now when I run the build, I get the following error:
Building remotely on jenkins-slave-win64 (Johnny5) (windows) in workspace C:\jenkins\workspace\continuous.xill
java.io.IOException: remote file operation failed: C:\jenkins\tools\hudson.model.JDK\Latest at hudson.remoting.Channel#200354fa:jenkins-slave-win64 (Johnny5): java.nio.file.AccessDeniedException: C:\jenkins\tools\hudson.model.JDK\Latest\bin\java.exe
at hudson.FilePath.act(FilePath.java:987)
at hudson.FilePath.act(FilePath.java:969)
at hudson.FilePath.deleteRecursive(FilePath.java:1171)
at hudson.tools.JDKInstaller.performInstallation(JDKInstaller.java:130)
at hudson.tools.InstallerTranslator.getToolHome(InstallerTranslator.java:68)
at hudson.tools.ToolLocationNodeProperty.getToolHome(ToolLocationNodeProperty.java:108)
at hudson.tools.ToolInstallation.translateFor(ToolInstallation.java:206)
at hudson.model.JDK.forNode(JDK.java:132)
at hudson.model.AbstractProject.getEnvironment(AbstractProject.java:360)
at hudson.model.Run.getEnvironment(Run.java:2234)
at hudson.model.AbstractBuild.getEnvironment(AbstractBuild.java:935)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1036)
at hudson.scm.SCM.checkout(SCM.java:485)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1277)
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:610)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:532)
at hudson.model.Run.execute(Run.java:1741)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:381)
Caused by: java.nio.file.AccessDeniedException: C:\jenkins\tools\hudson.model.JDK\Latest\bin\java.exe
at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:83)
at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97)
at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:102)
at sun.nio.fs.WindowsFileSystemProvider.implDelete(WindowsFileSystemProvider.java:269)
at sun.nio.fs.AbstractFileSystemProvider.delete(AbstractFileSystemProvider.java:103)
at java.nio.file.Files.delete(Files.java:1126)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at hudson.Util.deleteFile(Util.java:247)
Of course I tried everything:
Run sshd as a different (Administrator) user
Checked every error mentioned here:
https://wiki.jenkins-ci.org/display/JENKINS/SSH+slaves+and+Cygwin
here
https://wiki.jenkins-ci.org/display/JENKINS/My+software+builds+on+my+computer+but+not+on+Jenkins
and here
http://www.noah.org/ssh/cygwin-sshd.html
And nothing works. Do you have a hint where to look?
UPDATE:
Meanwhile I managed to get a bit further in the build process by deactivating the option to "Automatically install jdk" in the Jenkins settings, git clone works and gradle starts up. However, now the JAVA_HOME environment variable somehow is not accessible to the slave (although we even tried setting it in .bashrc, just to be sure). So the build fails with this message":
FAILURE: Build failed with an exception.
* Where:
Script 'http://dl.bintray.com/content/shemnon/javafx-gradle/8.1.1/javafx.plugin' line: 60
* What went wrong:
A problem occurred evaluating script.
> Could not find JavaFX Packager Tools, please set one of [jfxrtDir in Gradle Properties, JFXRT_HOME in System Environment, JAVA_HOME in System Environment, java.home in JVM properties]
For your build error after "UPDATE" I think you have to add a JDK under Manage Jenkins > Configure System > JDK or in newer versions under Manage Jenkins > Global Tool Configuration > JDK

Compilation failure in JNativeHook

Trying to compile this https://github.com/kwhat/jnativehook/wiki/Compiling
made it as far as the step where I have to run ant all to build.
Compile fails with the following in command prompt.
[javac] Fatal Error: Unable to find package java.lang in classpath or bootcl
asspath
BUILD FAILED
C:\Users\George\Downloads\sounds\JNativeHook-2.0.1\JNativeHook\build.xml:394: Co
mpile failed; see the compiler error output for details.
Total time: 0 seconds
EDIT: I just copied the rt file into the directory i'm trying to compile. I got past the first error but now I'm getting
ava\org\jnativehook\mouse\NativeMouseWheelListener.java
download-libuiohook:
bootstrap-libuiohook:
[echo] Bootstrapping libUIOHook...
[autoreconf] autoreconf --verbose --force --install
BUILD FAILED
C:\Users\George\Downloads\sounds\JNativeHook-2.0.1\JNativeHook\build.xml:351: Ex
ecute failed: java.io.IOException: Cannot run program "sh" (in directory "C:\Use
rs\George\Downloads\sounds\JNativeHook-2.0.1\JNativeHook\src\libuiohook"): Creat
eProcess error=2, The system cannot find the file specified
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
at java.lang.Runtime.exec(Runtime.java:620)
at org.apache.tools.ant.taskdefs.launcher.Java13CommandLauncher.exec(Jav
a13CommandLauncher.java:58)
at org.apache.tools.ant.taskdefs.Execute.launch(Execute.java:428)
at org.apache.tools.ant.taskdefs.Execute.execute(Execute.java:442)
at org.apache.tools.ant.taskdefs.ExecTask.runExecute(ExecTask.java:629)
at org.apache.tools.ant.taskdefs.ExecTask.runExec(ExecTask.java:670)
at org.apache.tools.ant.taskdefs.ExecTask.execute(ExecTask.java:496)
at org.jnitasks.autotools.AutoreconfTask.execute(AutoreconfTask.java:113
)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.jav
a:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:435)
at org.apache.tools.ant.Target.performTasks(Target.java:456)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1405)
at org.apache.tools.ant.Project.executeTarget(Project.java:1376)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExe
cutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1260)
at org.apache.tools.ant.Main.runBuild(Main.java:853)
at org.apache.tools.ant.Main.startAnt(Main.java:235)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:285)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:112)
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find th
e file specified
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(ProcessImpl.java:386)
at java.lang.ProcessImpl.start(ProcessImpl.java:137)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
... 24 more
Total time: 1 second
Still diligently trying to figure this out in the mean time.
Update:
I think I've been going about this wrong. I tried doing this inside MINGW64 which is probably how I should have been doing it.
Sadly still get an error I'm looking into.
compile-java:
[echo] Compiling Java source...
download-libuiohook:
bootstrap-libuiohook:
[echo] Bootstrapping libUIOHook...
[autoreconf] autoreconf --verbose --force --install
[autoreconf] autoreconf: Entering directory `.'
[autoreconf] autoreconf: configure.ac: not using Gettext
[autoreconf] autoreconf: running: aclocal --force -I m4
[autoreconf] aclocal-1.15: error: aclocal: file '/msys64/usr/share/aclocal/xsize .m4' does not exist
[autoreconf] autoreconf: aclocal failed with exit status: 1
BUILD FAILED
C:\Users\George\Downloads\sounds\JNativeHook-2.0.1\JNativeHook\build.xml:351: ex ec returned: 1
Total time: 2 seconds
UPDATE:
Wow so how many shells does msys64 have. I've now tried what seems to be the last and final shell msys2_shell.bat and its gotten even further but still fails.
Now I get
JNativeHook/bin --enable-debug --enable-quiet --enable-static --disable-shared --with-pic
[configure] checking build system type... x86_64-pc-msys
[configure] checking host system type... x86_64-pc-msys
[configure] checking target system type... x86_64-pc-msys
[configure] checking for a BSD-compatible install... /usr/bin/install -c
[configure] checking whether build environment is sane... yes
[configure] checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
[configure] checking for gawk... gawk
[configure] checking whether make sets $(MAKE)... yes
[configure] checking whether make supports nested variables... yes
[configure] checking for style of include used by make... GNU
[configure] checking for gcc... clang
[configure] configure: error: in `/c/Users/George/Downloads/sounds/JNativeHook-2.0.1/JNativeHook/bin/libuiohook':
[configure] checking whether the C compiler works... no
[configure] configure: error: C compiler cannot create executables
[configure] See `config.log' for more details
BUILD FAILED
C:\Users\George\Downloads\sounds\JNativeHook-2.0.1\JNativeHook\build.xml:361: exec returned: 77
Total time: 37 seconds
So close.
UPDATE:
Installed clang and now get this detailed error from the config.log file.
configure:3580: checking whether the C compiler works
configure:3602: clang -march=armv6j -mfpu=vfp -mfloat-abi=hard -Os -g -pipe -fomit-frame-pointer -flto -ffat-lto-objects -fno-stack-protector -Wl,--as-needed,-O1 -flto conftest.c >&5
clang.exe: warning: optimization flag '-ffat-lto-objects' is not supported
clang.exe: error: 'i686-pc-windows-gnu': unable to pass LLVM bit-code files to linker
configure:3606: $? = 1
configure:3644: result: no
configure: failed program was
:
Ok so for future JNativeHook compiler noobies like myself doing this on windows 8.1 here is what I had to do to get this working.
Aside from following all the steps in the compile for windows section provided on their git.
You also need to...
Download LLVM for windows.
Copy your rt.jar into the JNativeHook directory.
And make sure absolutely make sure that you've deleted any build.properties generated from failed builds.
That should get it working.
Dont forget to run ant distclean first if you are trying to compile 2.0.1. I botched the package process by forgetting to include the build.properties file in the exclude list for the zip file. I think that will also fix your rt.jar copying issue. It may solve all of your issues ;) Anyway, 2.0.2 will fix the problem and is scheduled for release on Sunday.

bin/hive giving issue with the errors

I have installed the hive using source and run ant package.
as per cwiki.apache.org document, I have added PATH var also i.e $HIVE_HOME and $PATH but running the command from base directory (bin/hive or hive)
It give the following error.
I have added the patch (HIVE-3606.1.patch) to resolve it but still it's not working.
Command to add patch:
hive-0.10.0-bin]$ patch -p0 < ~/Downloads/HIVE-3606.1.patch
To run Hive:
hive-0.10.0-bin]$ bin/hive
Exception in thread "main" java.lang.NoSuchFieldError: ALLOW_UNQUOTED_CONTROL_CHARS
at org.apache.hadoop.hive.ql.udf.generic.GenericUDTFJSONTuple.<clinit>(GenericUDTFJSONTuple.java:59)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.apache.hadoop.util.ReflectionUtils.newInstance(ReflectionUtils.java:113)
at org.apache.hadoop.hive.ql.exec.FunctionRegistry.registerGenericUDTF(FunctionRegistry.java:545)
at org.apache.hadoop.hive.ql.exec.FunctionRegistry.registerGenericUDTF(FunctionRegistry.java:539)
at org.apache.hadoop.hive.ql.exec.FunctionRegistry.<clinit>(FunctionRegistry.java:472)
at org.apache.hadoop.hive.ql.session.SessionState.<init>(SessionState.java:202)
at org.apache.hadoop.hive.cli.CliSessionState.<init>(CliSessionState.java:86)
at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:635)
at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:613)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.hadoop.util.RunJar.main(RunJar.java:156)
Can anyone help here?
It's most probably because your Hadoop uses a different (older) version of Jackson libraries than Hive. As a quick workaround you can replace jackson-core-asl-X-X-X.jar and jackson-mapper-asl-X.X.X.jar in $HADOOP_HOME/lib with the newer ones in $HIVE_HOME/lib
Its because you are working with old version of Hadoop.
If you have Hadoop, its better to compile the source code yourself with the following command for old version of Hadoop:
$ svn co http://svn.apache.org/repos/asf/hive/trunk hive
$ cd hive
$ mvn clean install -Phadoop-2,dist
Check this link for more info: https://cwiki.apache.org/confluence/display/Hive/GettingStarted
Then, change the jackson* file names in $HADOOP_HOME/lib and add an .old postfix to them (Its a good practice not to delete them, as we may want them in future):
$ mv jackson-core-asl-1.0.1.jar jackson-core-asl-1.0.1.jar.old
$ mv jackson-mapper-asl-1.0.1.jar jackson-mapper-asl-1.0.1.jar.old
You can find the new jackson compiled files somewhere around Hive's packaging folder, mine is in:
packaging/target/apache-hive-0.14.0-SNAPSHOT-bin/apache-hive-0.14.0-SNAPSHOT/bin/hcatalog/share/webhcat/svr/lib
If you can't find it, its ok. use the following command in your hive directory.
$ find ./ -iname "*jackson*"
It will show you all the jackson* files that it can find. Then go to that specific folder that contains them and copy all of them to the $HADOOP_HOME/lib (currently we may just need the "jackson-core-*" but we copy all for future use):
$ cp jackson* $HADOOP_HOME/lib
Ask if you have more enquiries.

Categories