Compiling Java & JARs?

No, that is not quite right. The key to everything is the classpath. Is all of the compiled code and/or other resources on the classpath?

If you package everything up in one single jar, then yes, it is in the classpath and the JVM will locate all the resources to run. Otherwise, you need to specify (with a . Bat or .

Sh file or something) all the resources that your application is dependent on, so the JVM will be able to appropriately look for those resources (be they Java code or properties files or whatever) Also if I am reading your question right, are you assuming that the CLI and JODA code gets compiled into your code? If so, I hate to burst your bubble, but that is not the case. When your code compiles, it does not bring in dependencies (not in the sense you may be thinking).

What it does at a conceptual level (correct me if I'm wrong JVM gurus) is it references other classes. Those references are what you are building when you code a class and compile it. At runtime the JVM will attempt to locate the compiled class behind the reference and THAT is where you either need the jar with those classes in the classpath OR you need those classes in your executable jar Make sense?

No, that is not quite right. The key to everything is the classpath. Is all of the compiled code and/or other resources on the classpath?

If you package everything up in one single jar, then yes, it is in the classpath and the JVM will locate all the resources to run. Otherwise, you need to specify (with a . Bat or .

Sh file or something) all the resources that your application is dependent on, so the JVM will be able to appropriately look for those resources (be they Java code or properties files or whatever). Also if I am reading your question right, are you assuming that the CLI and JODA code gets compiled into your code? If so, I hate to burst your bubble, but that is not the case.

When your code compiles, it does not bring in dependencies (not in the sense you may be thinking). What it does at a conceptual level (correct me if I'm wrong JVM gurus) is it references other classes. Those references are what you are building when you code a class and compile it.At runtime the JVM will attempt to locate the compiled class behind the reference and THAT is where you either need the jar with those classes in the classpath OR you need those classes in your executable jar.

Make sense?

Chris thios does make sense - and thank you! But now I guess I'm so confused I don't know what to ask...In Eclipse I have all the JARs on the classpath so Eclipse knows how to link to all the right resources. In my Ant build.

Xml file, how to I add JARs to the classpath (from within Ant) so that everything works perfectly when my executable JAR runs as a standalone command line tool? – zharvey Sep 6 at 18:14 Java uses the classpath to know where to look for . Class files.

Usually, you add . Jar files to the class path and Java will load those files. You can set the class path in one of several different ways.

For your situation, you should set the Class-Path attribute in the MANIFEST. MF file. Ant can help you here.

Simply add a manifest element to your jar task and set the Main-Class and Class-Path attributes. See here for more details: ant.apache. Org/manual/Tasks/jar.

Html – Jack Edmonds Sep 6 at 19:16.

The third party libraries (JodaTime, for example) need to be on the classpath during runtime. Not "packaged within your JAR". If your app is launched from a JAR.

You should specify the classpath in the manifest file which is packaged within the jar - download.oracle.com/javase/tutorial/depl... You can have ANT generate the manifest classpath for you using the manifestclasspath element - ant.apache.org/manual/Tasks/manifestclas....

Sh file or something) all the resources that your application is dependent on, so the JVM will be able to appropriately look for those resources (be they Java code or properties files or whatever). Also if I am reading your question right, are you assuming that the CLI and JODA code gets compiled into your code? If so, I hate to burst your bubble, but that is not the case.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions