RegEx and Program class in package

Really two questions.
1) Is there a class managing regular expressions, or wild card file matching.

2) is it possible to put application classes, (those with a main() ) in a package and or jar and run them.

Null Term
Who is Participating?
mbormannConnect With a Mentor Commented:
seems like u found the answer to 1)while I was away ,vladi's response is very good for 2).

I will only add
>>>include jar in classpath

have u included c:\abcd\ptl.jar  in classpath or just c:\abcd ?
(1) Look at OROMatcher & download it ,

look at this for how to use it. 

Mostly you need to specify the RegEx string and that's it ,the rest doesnt vary that much.

wild card file matching?
what do u mean to say?

NullTerminatorAuthor Commented:
Wild card file matching as in the the accept() method of a fileFilter class.  Using RegEx I could simulate the *.x?? syntax to find 'Excel' related files.

I'll try number 2 again. and post followup

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

NullTerminatorAuthor Commented:
OK, mbormann,  with the following

// package ptl;
class hello
      public static void main(String args[])      
            System.out.println("Hello World...");                  

I can add to jar and include jar in classpath and execute, but with package uncommented it can't find the class hello.

Any suggestion?  (jar is also named ptl.jar - conflict with package name ? )  tried jar cf and jar cf0 same result

Managing Source and Class Files

Creating and Using Packages

jar-The Java Archive Tool
Usage: jar {ctx}[vfm0M] [jar-file] [manifest-file] files ...
  -c  create new archive
  -t  list table of contents for archive
  -x  extract named (or all) files from archive
  -v  generate verbose output on standard error
  -f  specify archive file name
  -m  include manifest information from specified manifest file
  -0  store only; use no ZIP compression
  -M  Do not create a manifest file for the entries

If any file is a directory then it is processed recursively.
Example: to archive two class files into an archive called classes.jar:
  jar cvf classes.jar Foo.class Bar.class
Note: use the '0' option to create a jar file that can be put in your CLASSPATH
sun JAR tutorial
JAR format
Manifest files can contain arbitrary information about the files in the archive,
such as their encoding or language. If the JAR archive is intended for use with
the SmartUpdate feature of Communicator, the manifest file must include, at a minimum,
the address of the installation file

Using the Jar Manifest

Use a JAR/ZIP/CAB file with an Applet
Support for Multiple CABs or JARs in the Same APPLET Tag
NullTerminatorAuthor Commented:
Yes, I did explicitly include the jar file with jar extension.  Two things seem to affect it.  It seems ( by my reading ) that you may only have one 'main class' or application in a jar, and by my experience that the 'application' can't be in a package.

Thnaks for the help the tip for ORO was a big help.
I will award you the points.

what about some points for me? :)
why do you want points?
you have got enough,or you want to overtake heyhey?
NullTerminatorAuthor Commented:
sorry vladi, I shouldn't have put two topics in one question.  Your response to part two was helpful as well.
Yes I want to overtake heyhey! :)

Best regards
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.