Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jar classpath

 
Brian R Wolf
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi,

I know this class: org.apache.pig.Main exists in /cygdrive/c/pigtute/pigtmp/pig.jar , but when I run this, it doesn't seem to find it.


$ java -cp /cygdrive/c/pigtute/pigtmp/pig.jar org.apache.pig.Main


java.lang.NoClassDefFoundError: org/apache/pig/Main
Caused by: java.lang.ClassNotFoundException: org.apache.pig.Main
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLCl


Thanks

Brian
 
Rajeev Trikha
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use the syntax java -jar jar-file

Before you execute this command make sure the runtime environment has an information of which class within the JAR file is the application's entry point.

To indicate which class is the application's entry point, you must add a Main-Class header to the JAR file's manifest. The header takes the form:

Main-Class: classname

The header's value, classname, is the name of the class that's the application's entry point.

See http://java.sun.com/docs/books/tutorial/deployment/jar/appman.html
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic