Link to home
Start Free TrialLog in
Avatar of NullTerminator
NullTerminator

asked on

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.

Thanks
Null Term
Avatar of mbormann
mbormann

(1) Look at OROMatcher & download it ,
http://www.quateams.com/oro/software/OROMatcher1.1.html

look at this for how to use it.
https://www.experts-exchange.com/jsp/qShow.jsp?ta=java&qid=10244033 

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?

(2)Yes
Avatar of NullTerminator

ASKER

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

Thanks
'\0'
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
'\0'
look:

Managing Source and Class Files
http://java.sun.com/docs/books/tutorial/java/more/managingfiles.html

Creating and Using Packages
http://java.sun.com/docs/books/tutorial/java/more/packages.html

jar-The Java Archive Tool
http://java.sun.com/products/jdk/1.2/docs/tooldocs/win32/jar.html
---
C:\jdk\bin>C:\jdk\bin\jar.exe
Usage: jar {ctx}[vfm0M] [jar-file] [manifest-file] files ...
Options:
  -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 http://java.sun.com/docs/books/tutorial/jar/index.html
---
JAR format http://developer.netscape.com/docs/manuals/signedobj/jarfile/jar.htm
http://java.sun.com/products/jdk/1.2/docs/guide/jar/manifest.html 
http://developer.java.sun.com/developer/Books/JAR/basics/manifest.html
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
http://www.gamelan.com/journal/techworkshop/030199_jmani.html

---
Use a JAR/ZIP/CAB file with an Applet
http://codeguru.developer.com/java/articles/547.shtml
Support for Multiple CABs or JARs in the Same APPLET Tag
http://support.microsoft.com/support/kb/articles/Q177/1/59.ASP
ASKER CERTIFIED SOLUTION
Avatar of mbormann
mbormann

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.

NullTerminator
what about some points for me? :)
why do you want points?
you have got enough,or you want to overtake heyhey?
:-)
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
Vladi21