File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes File structure in a Java project Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "File structure in a Java project" Watch "File structure in a Java project" New topic
Author

File structure in a Java project

Jacky Luk
Ranch Hand

Joined: Aug 02, 2012
Posts: 598


What should I place the jar library that I have included in my project?
such as rs2xml.jar



Thanks
Jack
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10372
    
    8

External jars need to be on the classpath and not necessarily inside your project structure. In fact, having them on the classpath, lets you share them across projects.


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Jacky Luk
Ranch Hand

Joined: Aug 02, 2012
Posts: 598
Maneesh Godbole wrote:External jars need to be on the classpath and not necessarily inside your project structure. In fact, having them on the classpath, lets you share them across projects.


Hi, I am back
First of all,
I have a directory structure

I compile it by netbeans.
When I go to D:\Project\boksspatientproject\build\classes
I typed jar cvfm patient.jar MANIFEST.TXT boksspatientanalysis\*.class
a jar file patient.jar is created. However, I've got a message
Saying it cannot find the main class (Translated)

I believe, yes, it's the classpath problem
What classpath should I set in my case?
I've also learned from the web that there are some software that does this
- packaging all jar libs with the main jar into one jar so that there won't be any dependencies.
Do I have to set classpath as well if I use those software and packaged jar application?
Thanks
Jack
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10372
    
    8

Jack Luk wrote:a jar file patient.jar is created. However, I've got a message
Saying it cannot find the main class (Translated)

That has got nothing to do with your original question. This error is indicating, that the JVM is unable to find the application entry point
Recommended reading http://docs.oracle.com/javase/tutorial/deployment/jar/appman.html

You will have to specify which packaging applications you are referring to. Does it have any documentation? Does it answer your question regarding jars and classpaths?
Usually one also specifies the classpath in the manifest file http://docs.oracle.com/javase/tutorial/deployment/jar/downman.html
Jacky Luk
Ranch Hand

Joined: Aug 02, 2012
Posts: 598
Maneesh Godbole wrote:
Jack Luk wrote:a jar file patient.jar is created. However, I've got a message
Saying it cannot find the main class (Translated)

That has got nothing to do with your original question. This error is indicating, that the JVM is unable to find the application entry point
Recommended reading http://docs.oracle.com/javase/tutorial/deployment/jar/appman.html

You will have to specify which packaging applications you are referring to. Does it have any documentation? Does it answer your question regarding jars and classpaths?
Usually one also specifies the classpath in the manifest file http://docs.oracle.com/javase/tutorial/deployment/jar/downman.html


Hello Maneesh,
Thanks for your help first.
Okay, the entry point is found. But as the third-party libraries are not included in the jar file created, I've got these

I put the Class-Path: rs2xml.jar.. blah
still got the errors!
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10372
    
    8

I put the Class-Path: rs2xml.jar.. blah

Where is the rs2xml.jar? Is it the same place like your generated jar? Did you read the classpath link I had provided earlier?
Jacky Luk
Ranch Hand

Joined: Aug 02, 2012
Posts: 598
Maneesh Godbole wrote:
I put the Class-Path: rs2xml.jar.. blah

Where is the rs2xml.jar? Is it the same place like your generated jar? Did you read the classpath link I had provided earlier?


Dear Maneesh,
I put it in the same folder as the main jar file.
Thanks
Jack
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10372
    
    8

Can you show us your manifest file?
Jacky Luk
Ranch Hand

Joined: Aug 02, 2012
Posts: 598
Maneesh Godbole wrote:Can you show us your manifest file?


Here it is. Thanks

Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10372
    
    8

From the manifest classpath link I had provided earlier
Warning: The text file must end with a new line or carriage return. The last line will not be parsed properly if it does not end with a new line or carriage return.

Can you confirm your manifest file ends with a new line ?
Jacky Luk
Ranch Hand

Joined: Aug 02, 2012
Posts: 598
Maneesh Godbole wrote:From the manifest classpath link I had provided earlier
Warning: The text file must end with a new line or carriage return. The last line will not be parsed properly if it does not end with a new line or carriage return.

Can you confirm your manifest file ends with a new line ?


OK, now, thanks
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10372
    
    8

Jack Luk wrote:
OK, now, thanks

For the benefit of future uses, can you elaborate on this? Do you mean the manifest was missing the newline, which solved your problem?
Jacky Luk
Ranch Hand

Joined: Aug 02, 2012
Posts: 598
Maneesh Godbole wrote:
Jack Luk wrote:
OK, now, thanks

For the benefit of future uses, can you elaborate on this? Do you mean the manifest was missing the newline, which solved your problem?


Hi,
I forgot that I've deleted the libraries files in the same folder as the main jar. That's it
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: File structure in a Java project