quality@glassfish.java.net

Re: File locking tool project (was Re: Project query)

From: Sreekanth M <sreekanth.manga_at_gmail.com>
Date: Thu, 29 May 2008 09:59:08 +0530

Hi,

I have a small suggestion for you.When ever you install Java in your windows
machine, make sure you don't have any spaces in the location where you
install, like "Program Files".

Say If you installed Java in C:\Java\JDK.1.6, Set the following environment
variables in your machine:

JAVA_HOME : C:\Java\JDK1.6
Path : %Path%;C:\Java\JDK1.6\bin
Classpath: C:\Java\JDK1.6\lib\tools.jar;C:\Java\JDK1.6\jre\lib\rt.jar;

You can append any jar files that you want to be in the classpath at the end
of the above line.
Just to be more clear, You can set the environment variables by
right-clicking on 'My Computer' and selecting 'Properties'. Under the
'Advanced' tab, there is a button that allows you to set the 'Environment
variables'. Click on this and alter the 'Path' variable so that it also
contains the path to the Java executable. For example, if you have installed
Java in C:\Java\JDK1.6 and your path is currently set to
C:\WINDOWS\SYSTEM32, then you would change your path to read
C:\WINDOWS\SYSTEM32;C:\Java\JDK1.6\bin. Similarly You can add a new variable
Classpath if it doesn't exist and assign it the value
C:\Java\JDK1.6\lib\tools.jar;C:\Java\JDK1.6\jre\lib\rt.jar; as in our case.

Once all the variables are set, Now you can open a new command line prompt
and run your java files.

In your case you can simply say,

C:\>java -classpath <path-to-the-utility-jar> util.ZipFileMonitor -host
localhost -port 9009 -filter xyz


This link may help you to understand more clearly about the classpaths :

http://java.sun.com/j2se/1.5.0/docs/tooldocs/windows/classpath.html




On Thu, May 29, 2008 at 9:03 AM, KANIKA GUPTA <kaniks4u_at_yahoo.com> wrote:

> Hi
>
> we tried the command-line but get the following errors:
>
> Try 1:
> C:\Program Files>java -classpath c:\program
> files\;%JAVA_HOME%/lib/tools.jar util.ZipFileMonitor -host localhost -port
> 9009 -filter Enterprise
>
> Exception in thread "main" java.lang.NoClassDefFoundError:
> files\;C:\Program
> Caused by: java.lang.ClassNotFoundException: files\;C:\Program
> at java.net.URLClassLoader$1.run(Unknown Source)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.net.URLClassLoader.findClass(Unknown Source)
> at java.lang.ClassLoader.loadClass(Unknown Source)
> at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
> at java.lang.ClassLoader.loadClass(Unknown Source)
> at java.lang.ClassLoader.loadClassInternal(Unknown Source)
>
> Try 2:
> C:\Program Files>java -classpath .;%JAVA_HOME%/lib/tools.jar
> util.ZipFileMonitor -host localhost -port 9009 -filter Enterprise
>
> Exception in thread "main" java.lang.NoClassDefFoundError:
> Files\Java\jdk1/6/0_0
> 6\bin/lib/tools/jar
> Caused by: java.lang.ClassNotFoundException:
> Files\Java\jdk1.6.0_06\bin.lib.tool
> s.jar
> at java.net.URLClassLoader$1.run(Unknown Source)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.net.URLClassLoader.findClass(Unknown Source)
> at java.lang.ClassLoader.loadClass(Unknown Source)
> at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
> at java.lang.ClassLoader.loadClass(Unknown Source)
> at java.lang.ClassLoader.loadClassInternal(Unknown Source)
>
> Try 3:
> C:\Program Files>java -classpath
> .\ZipFileMonitor.jar;%JAVA_HOME%/lib/tools.jar
> util.ZipFileMonitor -host localhost -port 9009 -filter Enterprise
> Exception in thread "main" java.lang.NoClassDefFoundError:
> Files\Java\jdk1/6/0_0
> 6\bin/lib/tools/jar
> Caused by: java.lang.ClassNotFoundException:
> Files\Java\jdk1.6.0_06\bin.lib.tool
> s.jar
> at java.net.URLClassLoader$1.run(Unknown Source)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.net.URLClassLoader.findClass(Unknown Source)
> at java.lang.ClassLoader.loadClass(Unknown Source)
> at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
> at java.lang.ClassLoader.loadClass(Unknown Source)
> at java.lang.ClassLoader.loadClassInternal(Unknown Source)
>
> The File Locking Diagnostic Tool is saved in c:\program files and i have
> installed jdk1.6...
> and the JAVA_HOME is set as C:\Program Files\Java\jdk1.6.0_06\bin
>
> Please help, where we might be going wrong...
>
>
> *Tim Quinn <Timothy.Quinn_at_Sun.COM>* wrote:
>
>
>
> KANIKA GUPTA wrote:
>
> Hi
>
> We are working on the project: "File Locking Diagnostic Tool"
>
> I was following the blog:
> http://blogs.sun.com/quinn/entry/tool_for_diagnosing_failed_glassfish
>
> To run the tool we need to follow the following commands:
> java -classpath <path-to-the-utility-jar>;%JAVA_HOME%/lib/tools.jar
> util.ZipFileMonitor -host yourhost -port 9009 -filter xyz
>
> We can't exactly figure out what it means to actually run the same...
> Have been able to set up the debugging options in the glassfish admin, but
> can't figure out the above to continue... I mean is it one single command or
> a group...
>
> Please help...
>
>
> Kanika
>
> Hi, Kanika.
>
> Did you try that as a single command and have problems?
>
> That's a standard (single) java command line. Make sure you have defined
> the environment variable JAVA_HOME to point to the directory that contains
> the Java JDK you want to use. Any version from 1.5 onward should be fine.
>
> The class path is <path-to-the-utility-jar>;%JAVA_HOME%/lib/tools.jar
>
> The main class to execute is util.ZipFileMonitor
>
> The rest of the command line contains arguments to the file monitor
> utility: what host you have GlassFish running on, what port you configured
> for the debugger in GlassFish, and the file filter you want the file monitor
> utility to use. These arguments are explained in the blog.
>
> Let us know if you have further questions.
>
> - Tim
>
>
>
>
> Kanika
>
>


-- 
M SREEKANTH
Mobile: 9986710468