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

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.

Related

snapscraft snap.yaml for java apps using swing ui on ubuntu

I have a basic java app using java.awt Swing UI and I want to create a snap for it so when it's installed there is a launcher available and my UI Launches. I use gradle and the jar task to create a jar which works fine.
Naturally I have in a class that when called loads my app just fine:
package com.foo
class Bar() {
static void main(String... args) { launchUI() }
}
I created a snap folder at the root of the project and a snap.yaml where i followed the instructions on https://snapcraft.io/docs/java-applications so i have a snap yaml that produces a snap file which also installs fine:
name: deepthought
base: core18
version: '0.0.7'
summary: ""
icon: gui/foo.png
description: |
Computes the ultimate answer for life the universe and everything
grade: devel # must be 'stable' to release into candidate/stable channels
confinement: devmode # use 'strict' once you have the right plugs and slots
# This doesn't work
#apps:
# htmldoc:
# command: desktop-launch $SNAP/bin/foo.sh
## desktop: share/applications/htmldoc.desktop
# plugs: [home, network, x11]
parts:
foopart:
plugin: gradle
source: https://github.com/bsautner/foo.git
source-type: git
gradle-options: [] # suppress running of tests and run the war task
gradle-output-dir: build/libs
I've spent quite some time trying to figure out:
If i create a shell script to run a java -jar foo.jar command it ends up in the /snap directory but it's not on the users path so they can't get to it
I've tried creating launchers but always get an error that my launcher can't be found, if i put it in my root folder as /bin/launch.sh snap can't find it and if i put it in the snap/bin/ folder i also get errors to not put things in the snap folder
When I do install my snap, i don't see where it puts my jar i want to execute, so i can't write a script that does that
I'd really appreciate if anyone can share a working snap.yaml for a java program with a launcher and if there is any mention of a path to something that you note where those files are in relation to the path of the /snap/snap.yaml file
ok figured it out - the docs don't say this but the files are relative to the root of the project so even though the yaml says this is the launch
apps:
cmd3:
command: usr/bin/foo.sh
foo.sh should be in the root of the project and the orginize section here moves it to the bin dir
foo:
plugin: gradle
source-type: local
source: .
build-packages:
- openjdk-11-jdk
stage-packages:
- openjdk-11-jdk
- x11-utils
organize:
${SNAPCRAFT_PART_BUILD}/jg-snap: usr/bin/foo.sh
The jar is in the /snap/foo/current/usr/jar directory

Can not run program, permission denied erro13 Jenkins

I created a new job for android new project on Jenkin. Whenever I run the job I got error java.io.ioexception error 13 permission denied. Jenkin says unable to run program gradlew. I know gradlew script need execution permissions according to the error explanation . I granted these and re run the jenkin job. I still get the same error. Jenkin revert the execution permission back after build. When I create new job from existing job and configured with old projects repository , it runs fine. when I configured with new project repository it raised permission issues. I played a lot with permission but no success. I also compared old and new project script file. There was few lines difference but it shouldn't be an issue. Any one can guide me what I am doing wrong.
Thanks
It is clearly a permission issue.
java.io.IOException: Cannot run program "<http://jenkins.gradlew"
error=13, Permission denied
Caused by: java.io.IOException: error=13, Permission denied
There are two solutions to resolve the gradlew permission issue.
Go to Jenkin Job configuration
Go to Build tab and check gradlew executable.
Jenkin will change the permission when you press build now. Keep in mind that these changes are uncommitted. The process works fine if your job is not a release job. If it is release job it creates another issue that I came across.
:workspace:app:checkCommitNeeded FAILED
:app:release FAILED
* What went wrong:
Execution failed for task ':workspace:app:checkCommitNeeded'.
> You have uncommitted files:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
M gradlew
So work around is
commit gradlew with executable bit set:
git update-index --chmod=+x gradlew
git commit
Then you will no longer need the jenkins setting to set it executable, which is the workaround causing the 2nd issue.
Hopefully it would save someone time because I spent hours for the work around.
I was using Github for source code management. It was fetching code there and was updating it every single time, so changing it to +x before submitting my Jenkins job didn't help.
In Linux the project is at /.jenkins/workspace/MyProjectName/SomeSubFolder/gradlew - and it was loosing +x evereytime a new job was submitted (to 644, I think).
The solution was to select the Make gradlew executable checkbox (in Build --> Use Gradle Wrapper) - it is 755 now, and is executing gradle tasks.
Are you using a jenkinsfile for your job configuration?
If so you need to add the permission change for gradlew there.
sh 'chmod 755 ./gradlew'
It sounds like your gradlew is being replaced each time with a version that doesn't have the execute permission set so you will need to do it as part of the jenkins job either via a script or the jenkinsfile.

SimGrid-3.13 Can't load classes

There are steps for building .jar file of SimGrid.
I downloaded archive from here.
Then I made following
cmake -DCMAKE_INSTALL_PREFIX=/home/Documents/simgrid -Denable_maintainer_mode=off -Denable_compile_optimizations=off -Denable_java=on -Denable_model-checking=off
make
make check
100% tests passed, 0 tests failed out of 586
ctest
100% tests passed, 0 tests failed out of 586
make install
There is simgrid.jar in SimGrid-3.13 folder.
But when I write code I can't load classes from this .jar file.
How can I fix it?
UPDATED
If I download ready simgrid.jar from thence, error occurs
Exception in thread "main" java.lang.UnsatisfiedLinkError: /tmp/simgrid-java2166199247712718748/libsimgrid.so: libcgraph.so.6: cannot open shared object file: No such file or directory
Where I have to add libsimgrid-java.so, libsimgrid.so?
UPDATED2
After installing graphviz graphviz-dev. New error occurs
Invalid XML (XML input line 2, state 2): Bad declaration <!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid.dtd">.
If your are using a XML v3 file (check the version attribute in <platform>), please update it with tools/simgrid_update_xml.pl
[0.000000] /builds/workspace/SimGrid-Multi/build_mode/Debug/node/simgrid-ubuntu-trusty-64/build/SimGrid-3.13/src/surf/xml/surfxml_sax_cb.cpp:55: [surf_parse/ERROR] Parse error at (null):2: Parse error in /home/ken/IdeaProjects/Sim2Sim/src/main/java/LHCb/platform.xml
[0.000000] /builds/workspace/SimGrid-Multi/build_mode/Debug/node/simgrid-ubuntu-trusty-64/build/SimGrid-3.13/src/surf/xml/surfxml_sax_cb.cpp:57: [xbt/CRITICAL] Exiting now
As for the second update, you should read the error message that you copy-pasted:
If your are using a XML v3 file (check the version attribute in <platform>), please update it with tools/simgrid_update_xml.pl
Can you confirm that:
(1) the version attribute in the <platform> is 3
(2) running the tools/simgrid_update_xml.pl script on the platform fixes the problem?
I just checked the Debian package search page, in the second search box. I looked for /usr/lib/libcgraph.so.6 and it says that this library is in the package libcgraph6. So you have to apt-get install libcgraph6 to get it.

Error while running pjsip sample pjsua on android ndk

I successfully performed ./configure-android and make dep && make install commands using pjsip and I successfully install SWIG too.
But I am getting the following error while running the sample pjsua.
/Users/Downloads/swig-2.0.11 -c++ -o jni/pjsua_wrap.cpp -package org.pjsip.pjsua -outdir src/org/pjsip/pjsua -java jni/pjsua.i
make: execvp: /Users/Downloads/swig-2.0.11: Permission denied
make: *** [jni/pjsua_wrap.cpp] Error 127
Seems that MY_SWIG variable in pjsip-apps/src/pjsua/android/Android.mk is pointing to /Users/Downloads/swig-2.0.11 instead to swig binary file.
If you downloaded swig source to /Users/Downloads/swig-2.0.11 and you build it, binary file should be at: /Users/Downloads/swig-2.0.11/swig
Another problem you maybe find is that object files for project pjsua-app does not exists, this is because this is not done by default on the general build (more specifically, corresponding target is not included on all target at pjsip-apps/build/Makefile). To fix this just go to pjsip-apps/build and run:
make pjsua
This would create proper object files at: pjsip-apps/build/output/pjsua-arm-unknown-linux-androideabi/ (needed when building android sample)

TCLBLEND FAILURE - Centos 6.4

I have been trying to use a home grown test tool and after doing an update to Centos 6.4, I am no longer able to run the tcl based tool. I am getting the following error and I have no internet access on this server. Kindly advise how do I solve this problem?
Thanks
"XpUtils::iload -d /usr/local/testtool/repo/package/linux-glibc2.3-x86_64/lib/tcljava1.4.1 tclblend" failed:
couldn't load file "/usr/local/testtool/repo/package/linux-glibc2.3-x86_64/lib/tcljava1.4.1/libtclblend.so": libjava.so: cannot open shared object file: No such file or directory
while executing
"error "\"XpUtils::iload -d $dir tclblend\" failed:\n $errMsg""
(procedure "loadtclblend" line 168)
invoked from within
"loadtclblend /usr/local/testtool/repo/package/linux-glibc2.3-x86_64/lib/tcljava1.4.1"
("package ifneeded java 1.4.1" script)
invoked from within
"package require java"
("eval" body line 1)
invoked from within
"eval package require $pkg"
("foreach" body line 2)
invoked from within
"foreach pkg $pkgList {
set ::${pkg}Version [eval package require $pkg]
}"
(file "/usr/local/testtool/testtool" line 165)
If you read the error message trace, you'll see that it says that this is all caused by:
libjava.so: cannot open shared object file: No such file or directory
The first steps would then be to ensure that you've got a version of Java actually installed, to check that it includes the file libjava.so, and that the file has been indexed by the system shared library catalog.
It might also be worth checking that all its dependencies are also present and that you've got the architecture for the Tcl library and the Java library matched (e.g., both 32-bit) as those can cause odd failures when they go wrong.

Categories