Ant Copy Task: Failed to copy due to java.io.FileNotFoundException - java

I'm trying to compile a Flex application in Ant (no problems here, I can do it fine). When I try to publish the contents of the project to a Windows network drive (known as "Z:\" on my system), I get the following LAME exception thrown by Java/Ant:
BUILD FAILED
C:\workspace\bkeller\build.xml:42: Failed to copy C:\workspace\bkeller\web\assets\text\biography.html to Z:\web\bkeller\assets\text\biography.html due to java.io.FileNotFoundException Z:\web\bkeller\assets\text\biography.html (The system cannot find the file specified)
Which kind of sucks. I can't find any way to get rid of this problem and it's pretty crucial to my project that I get this working. I know for sure that I have read/write/execute permissions on the network drive, I can create/edit/delete files on the drive just fine through Windows explorer.
Drive Z is a network mount to virtualbox, allowing me to get access to my host OS, Ubuntu. I've double checked that it has write permissions. Any ideas?

Seeing as how Z is a network mount, verifying that it works (e.g. that you can create / write files) through Windows Explorer may not be the same thing as verifying that it works from within Ant:
You may have specified the necessary user / password sometime in the past and Explorer remembered it (so it doesn't ask you again). Ant obviously wouldn't.
Ant may run as a different user, especially if you spawn another process inside the build.
Can you write a simple test in java and see if it can create a file on your Z: drive? Perhaps that'll provide some insight. You can also run ant with -debug switch and see if it provides a more detailed info. At the very least it would print a stack trace and you can download Ant source and see what's happening.

Just experienced the same problem. The copy target was a regular network drive connected to my Windows 7 machine.
I was able to solve the problem by restarting Eclipse.
The cause might have been that Eclipse was running with Administrator privileges because of an Eclipse update I had been performing beforehand.

Does it go without saying that the file actually exists? Regardless, while you may have permission, does the process that is actually running the ant task have permission?

you certainly thought about it, but have you tried
Z:/web/bkeller/assets/text/biography.html
I always use the / instead of \ even on Windows and can't remember having a problem with the Copy target.

It was a problem in VirtualBox's shared folder system. It was fixed a few releases ago by 3.0.X.

Related

How to install java 1.1 on 64-bit Windows with no folder called AppData?

Recently i have been working with a project that requires Java 1.1 version. But whenever i try to run the
jdk-1_1_8_006-win.exe file , I have been receiving a message as shown below.
Image showing error:
After clicking ok on that:
I have seen one answer in stack overflow like
Get the Java installer files.
Execute jdk-1_1_8_010-windows-i586.exe When the error dialog is
displayed, open C:\USERS(User Name)\APPDATA\LOCAL\TEMP\~EXB0000 (Do
not click the OK button at this time) Copy all files to another folder
Click the ok button Download the tool and execute it.
Download Is3Engine.zip (ReactOS's InstallSheild Engine 3.0) Extract
Is3Engine.zip (containssetup.exe) Move setup32.exe to the copied Java
installers Execute setup32.exe
But the issue here is I am unable to find an Folder called APPDATA in my PC.
FWIW, this isn't due to AppData not being there; if it wasn't, your system would break in all kinds of weird ways. It's hidden and system, because messing with it can break it, but it's still there; you can change Explorer's settings if you really want to see it.
This error is because 16-bit software can't run on 64-bit Windows, and out of sheer inertia, the use of 16-bit installers continued all the way into the early 2000s. Windows x64 has workarounds for a few common ones, like Installshield and NSIS, but anything other than that will instantly fail.
There's really nothing you can or ideally should do other than installing it on a VM of an older system that it was meant to run on.

"Input file specified two times." error when using Cygwin sort on Windows

I'm building a desktop app that uses Cygwin to execute shell scripts on Windows 10. Ideally, users wouldn't have to install Cygwin because I'm putting the relevant exe files in my project. I have Cygwin's "sh.exe" in my project which I can call without an absolute path and it seems to be running grep, zcat, awk, etc with no issues.
It looks like I'm running into the issue explained in https://www.question-defense.com/2010/08/25/windows-7-cygwin-sort-input-file-specified-two-times where Window's cmd is using it's own sort rather than Cygwin's sort.exe and you have to put the path of the sort.exe in the script. So it looks like the user would have to download Cygwin which would somewhat defeats the purpose of my project because I want a hassle-free experience for users. I don't want them to have to download dependencies.
The only resolution I've thought of is to include the sort.exe in the project and replace the "sort" string in the script with the Windows path of the sort.exe, which I think would be in the directory where the user launched the app; maybe System.getProperty("user.dir").
Is there a better solution?
MobaXTerm seems to have got it down. They have a CygUtils plugin, which you have to download and put in the right place, but I imagine it wouldn't be hard for them to have their application come with CygUtils. I'm trying to do something like that.
I faced same issue while using Cygwin.
I renamed [cygwin64_folder]\bin\sort file to csort (or any other convenient name if you wish) and used csort command for my usage.

Can't figure out cause for NoClassDefFoundError: aspose/pdf/Paragraph

I can't get any pages of my webapp to load (locally on Tomcat 7.0.2.6), due to this NoClassDefFound error. I'm at my wits end trying to figure out what the cause is, here is what I know:
My coworker has this project successfully running locally (on Tomcat) and on our development server (WebLogic).
I have done a fresh pulldown from svn so my code is exactly the same as his. I've verified that I have a shared library reference to Aspose (and that the required .jars are in there), and that weblogic.xml has an entry for it.
We saw this same error when initially deploying on WebLogic because the Aspose library was named incorrectly, but it ran fine locally on his Tomcat server.
I've tried cleaning and rebuilding the project to no effect.
As best as I can figure, it has to be either a Tomcat issue, or maybe an Eclipse setting.
Has anyone encountered a similar situation? Any ideas on what to try to resolve this?
First thing you need to do is determine if you are colliding with another class with the same name and package. The easiest way to do this is with the cygwin/linux console, save this shell script to a file say, findjar
find "$1" -name "*.jar" -exec sh -c 'jar -tf {}|grep -H --label {} '$2'' \;
put it in your path and navigate to the root of the server instance and run the script like this
findjar . yourclass
Note the period, dont forget it. this will return if you have multiple classes with the same name in your project.
once your sure the project is clean and there is only one copy of the class, i would try actually adding your shared libraries folder to the websphere server instances JVM arguments. to do that:
Go into the admin, click on servers
Open server types, click on websphere application servers
You should see your server listed there, click on it
On the right hand side, you will see a section “server infrastructure” and below that is a subsection “Java and process Management”
Open that section and click on “Process Definition”
On the process definition screen is another right hand column. Click on “Java Virtual Machine”
Yes, finally we are on the correct screen, there is an end in sight here, I promise
On the virtual machine page, there is a large text field labeled “Classpath” What you need to do is enter the full path to the shared libraries folder
its odd and makes no sense to have to do it, but i have had to do that in the past to allow my code to see the properties files in a shared resource.
It is possible that your colleague has java librarys installed within his Tomcat instance itself.
Take a look in the Tomcat directory for some lib folders (I cant remember the exact location and I think it changes based on the version) but something like ${CATALINE_HOME}/common/lib
Verify that he doesnt have differen JAR files in his tomcat installation as yours.
From this question: Does Tomcat load the same library file into memory twice if they are in two web apps?
They are apparently stored here:
Tomcat 6 $CATALINA_HOME/lib
Tomcat 5 $CATALINA_HOME/common/lib

JAR executable doesn't start if it's in Programs directory

I'm into a very strange issue that's making me crazy .-.
I'm working on a relatively big Java project on Windows, using NetBeans and IzPack to prepare the graphical installation package.
Everything is ok, the compiled installer seems to work and my program is copied in 'C:\Programs\MyProject' folder.
But... when I double click on the myproject.jar in that folder it doesn't start at all. I obviously tried to open a prompt and type 'java -jar myproject.jar' but nothing, not even a line of error code.
The curious facts are two:
if I open it using the prompt with administration rights it works
in the same folder there is another jar, 'uninstaller.jar' created by izpack, and it works with double click.
I double checked my JVM installation, the PATH/JAVA_HOME/... values, and Properties->Security tab of my JAR but the permissions to execute/read/write for every kind of user are ok, and also are equal to the uninstaller.
So what's the problem? Thanks
This is almost certainly caused by Windows UAC on Vista and Windows 7.
Your program is probably trying to write to data files in the same directory as it is installed.
On Windows, well behaved programs write to the users or all users app data directory.
The location of that directory varies depending on the version of Windows.
You can use the system property "user.home" to find a safe place to store data.
You can also get a list of environment variables for shared and per user program data folders from here.

UnsatisfiedLinkError "Access is denied" even with Full Control

I'm getting a java.lang.UnsatisfiedLinkError from java.lang.ClassLoader$NativeLibrary.load() with the message "Access is denied". The DLL is being loaded from a network share via a UNC path. It previously worked without error on other network shares (I have been told by a sysadmin that this particular share is more "natively Windows"), so my first instinct was to use cacls to grant Full Control on the DLL file both for Everyone and the specific user running the Java code. When I view the DLL Properties in Windows Explorer, it clearly has those permissions set, and yet it is still failing with this error. Any ideas?
One possibility is that this dll is, in turn, trying to load other dlls, which have not been given sufficient permissions.
Run it as System Administrator and it will work for sure. I had a same problem and ran the Eclipse as Administrator and it worked.

Categories