Leela Sridhar

Greenhorn
+ Follow
since Nov 17, 2002
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Leela Sridhar

Hello

I have a java program which does file copy. Its working when the program is running in NT machine and source & destination are NT.

File copy is not working when File source is NT and File Destination is Solaris. It says it found the file in NT but unable to copy it. I have a drive map from solaris to NT. The following is the line of code written for file copy
File dir = new File(destDir);
return requiredFile.renameTo(new File(dir, requiredFile.getName()));
the return is false.

Can anybody suggest me what change I have to make so that the copy takes place....I know renameTo is platform-dependent.

Thanks in advance

Sridhar
15 years ago
Hey

I found out the problem..the problem is the jar files got corrupted...I tried to look into jar files using the command jar tf <jar-filename> it throws an error...if the jar file is not corrupted then it will list of all the file names.

I updated the correct jar files and everything worked...

I hope it could be one of the points when problems like ClassNotFound Exceptions come just look into jar file...who knows
15 years ago
I run the command

$ ls -l /home/ln52701/FileWatcher/source/lib/log4j-1.2.13.jar
-rwxr-xr-x 1 ln52701 misc 358172 Jul 27 12:31 /home/ln52701/FileWatcher/source/lib/log4j-1.2.13.jar

$

Sridhar
15 years ago
Hello

I added the ls and echo please find below the output and error messages

$ ksh FA.sh
ls -l /home/ln52701/FileWatcher/source/lib/log4j-1.2.13.jar
:/home/ln52701/FileWatcher/lib/FA.jar:/home/ln52701/FileWatcher/lib/commons-logging-1.1.jar:/home/ln52701/FileWatcher/lib/j2ee.jar:/hom
e/ln52701/FileWatcher/lib/log4j-1.2.13.jar:/home/ln52701/FileWatcher/lib/mail.jar:/home/ln52701/FileWatcher/lib/FA.jar
$

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/log4j/Category


I changed the permission chmod 777 log4j-1.2.13.jar

infact all jar files

Sridhar
15 years ago
Hello

I have the following batch file in NT
C:
cd C:\Neti\JavaProgs\062806\FlieWatch
java -cp %CD%;%CD%\lib\j2ee.jar;%CD%\lib\mail.jar;%CD%\lib\log4j-1.2.13.jar;%CD%\lib\commons-logging-1.1.jar; FileAlert DEV

pause

The application now needs to be moved to solaris environment. So I changed the batch file to shell script as follows

for name in /home/ln52701/FileWatcher/lib/*.jar ; do
CP=$CP:$name
done
CP=$CP:/home/ln52701/FileWatcher/lib/FA.jar
java -cp $CP FileAlert DEV 2>/home/ln52701/FileWatcher/lib/log.err 1>/home/ln52701/FileWatcher/lib/log.out

When I run the script I am getting the following error

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/log4j/Category
~
~

I beleive the script file is not recognizing the jars properly...

I tried to compile the source files individually

$ javac -classpath /home/ln52701/FileWatcher/source/lib/log4j-1.2.13.jar ApplicationProperties.java
ApplicationProperties.java:10: cannot resolve symbol
symbol : class Logger
location: package log4j
import org.apache.log4j.Logger;
^
ApplicationProperties.java:22: cannot resolve symbol
symbol : class Logger
location: class ApplicationProperties
private static Logger log;
^
2 errors
$

Am I giving wrong path or where its going wrong....

Thanks In advance for help

Sridhar
15 years ago
Hi,
The following explanation will work on WINDOWS environment.
If you have to set the classpath do the following steps...
1. Locate the directory where your java executables are existing (For eg. the default directory when you install will be c:\j2sdk1.4.0
If you are using some other version of java then that path like c:\jsdk1.2.0 )
2. Once you have located the path write it down in a piece of paper for easy reference.
3. Open Autoexec.bat file which is located in your C:\ drive. If it is not there create one.
4. In that give the following lines.
C:\j2sdk1.4.0\bin;C:\j2sdk1.4.0\include;C:\j2sdk1.4.0\src;C:\j2sdk1.4.0\LIB;C:\j2sdk1.4.0\jre;
5. Save your autoexec.bat file.
6. Reboot(Restart the system)
Now this will define the classpath.
Why classpath is needed???
To run the application java needs to know where the bin and include libraries are located. To compile your application or to run your application java needs libraray and include files.
By defining the classpath you are showing executables located in the specific directory
18 years ago