Few questions after building Ant file in eclipse
posted 11 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
I created a build file using Export option in the context menu of the Eclipse project. Creating the build.xml was not a difficult thing, so to speak as it was managed by Eclipse.
Then I ran the build file by right clicking on it - and selecting the desired option. Now I added a sample java class in the default package. But running the build did not run this Java class.
This is the build.xml:
Some doubts that popped up into my head; how do I run the project after successfully building it? It appears from the docs that I would need a separate <target>. If I have two class files that I have to execute back to back what steps do I take?
And if I have to build this project from command line, how would I proceed? I'm new to Ant and will deeply appreciate your thoughts.
Then I ran the build file by right clicking on it - and selecting the desired option. Now I added a sample java class in the default package. But running the build did not run this Java class.
This is the build.xml:
Some doubts that popped up into my head; how do I run the project after successfully building it? It appears from the docs that I would need a separate <target>. If I have two class files that I have to execute back to back what steps do I take?
And if I have to build this project from command line, how would I proceed? I'm new to Ant and will deeply appreciate your thoughts.
posted 11 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Ashan,
What do you mean by not running the second file? Did it not create a .class file? Or something else? To troubleshoot the problem, try right clicking the Ant xm and choosing "run as" > "Ant build...". The put "-v" in the main tab's argument section. That puts Ant into debug mode. Post the output here. (assuming it is very long, the last 50 lines should be fine)
To run at the command line, you type ant nameOfBuild file. You might need to add Ant to your path. (It can be found in the plugins directory of Eclipse or you can download it from the internet.)
This isn't the problem, but it isn't good practice to use the default package.
What do you mean by not running the second file? Did it not create a .class file? Or something else? To troubleshoot the problem, try right clicking the Ant xm and choosing "run as" > "Ant build...". The put "-v" in the main tab's argument section. That puts Ant into debug mode. Post the output here. (assuming it is very long, the last 50 lines should be fine)
To run at the command line, you type ant nameOfBuild file. You might need to add Ant to your path. (It can be found in the plugins directory of Eclipse or you can download it from the internet.)
This isn't the problem, but it isn't good practice to use the default package.
[OCP 21 book] | [OCP 17 book] | [OCP 11 book] | [OCA 8 book] [OCP 8 book] [Practice tests book] [Blog] [JavaRanch FAQ] [How To Ask Questions] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
posted 11 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Thank you for your response. Somehow the build failed. I have passed the "-v" argument as you suggested. Following is the output that got sent to the console:
I was under the impression that this build file is only bound to work with Eclipse. Will try running this from command line while ensuring that Ant is in the PATH.
And the test class was compiled after building it again. I am wondering which target was responsible for that.
I was under the impression that this build file is only bound to work with Eclipse. Will try running this from command line while ensuring that Ant is in the PATH.
And the test class was compiled after building it again. I am wondering which target was responsible for that.
posted 11 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Also do Java developers find themselves hand coding the build file to customize something (for instance running JUnit test) after Eclipse has generated that very file?
Please pardon my ignorance; I have just started with Ant and the learning curve looks steep.
Please pardon my ignorance; I have just started with Ant and the learning curve looks steep.
posted 11 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
At least the error is in there:
This means you need to set JAVA_HOME and possibly add the JDK to your path on the operating system level. In Windows, it is under "System".
Most people don't generate an Ant build from Eclipse so the question of hand coding doesn't come up. People generally either write their own Ant build outside of Eclipse or use Maven.
com.sun.tools.javac.Main is not on the classpath.
Perhaps JAVA_HOME does not point to the JDK
This means you need to set JAVA_HOME and possibly add the JDK to your path on the operating system level. In Windows, it is under "System".
Most people don't generate an Ant build from Eclipse so the question of hand coding doesn't come up. People generally either write their own Ant build outside of Eclipse or use Maven.
[OCP 21 book] | [OCP 17 book] | [OCP 11 book] | [OCA 8 book] [OCP 8 book] [Practice tests book] [Blog] [JavaRanch FAQ] [How To Ask Questions] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
posted 11 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Is there a JDK version mismatch or something else? My bin/ directory of JDK is already on the path. Here is the output after running with -debug:
Edit: I realized that I had to add the JAVA_HOME variable as well. I went ahead and created a new system env variable with value:
But the same problem persists. Is my JAVA_HOME pointing to correct path?
Edit: I realized that I had to add the JAVA_HOME variable as well. I went ahead and created a new system env variable with value:
But the same problem persists. Is my JAVA_HOME pointing to correct path?
posted 11 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
That looks correct, please verify that this file exists: C:\Program Files\Java\jdk1.6.0_12\lib\tools.jar
That JAR file file contains the com.sun.tools.javac.Main class reported missing.
That JAR file file contains the com.sun.tools.javac.Main class reported missing.
| Goodbye moon men. Hello tiny ad: The new gardening playing cards kickstarter is now live! https://www.kickstarter.com/projects/paulwheaton/garden-cards |











