All things are lawful, but not all things are profitable.
Knute Snortum wrote:Before anyone can help you, we need at least the exact code you tried to compile and the error messages it produced.
All things are lawful, but not all things are profitable.
Knute Snortum wrote:You have copied and pasted much of your reply. This isn't helpful.
It is difficult to tell exactly what you're trying to do. Please TellTheDetails but also IsolateTheProblem (those are links).
All things are lawful, but not all things are profitable.
Knute Snortum wrote:In the code above, the biggest problem is this:
Simply add e.printStackTrace(); and you can see that there is an error when you run the program. Address those errors and post back here if you get stuck.
All things are lawful, but not all things are profitable.
Knute Snortum wrote:I don't have an answer to your question about the NullPointerException, but I'd like to find out what you are trying to do. It seems like you are trying to create a build.xml file for ant in Java. Usually the build.xml file is created by hand. Can you tell me why your trying to create it with Java?
All things are lawful, but not all things are profitable.
Knute Snortum wrote:I can't find any way to generate an Ant build file from Java. You can generate them from an IDE like Eclipse or IntelliJ. In Eclipse, try File > Export > General > Ant buildfiles.
Generating an Ant buildfile from a Java program sounds like a monumental task. I would try using an IDE first.
As for you NPE in your Java program, I only know that you should use...
https://ant.apache.org/manual/api/org/apache/tools/ant/Project.html#createTask-java.lang.String-
I don't know if this will clear it up or not. I'm not familiar with the org.apache.tools.ant package and I can't find any documentation on how to use it.
Knute Snortum wrote:I can't find any way to generate an Ant build file from Java. You can generate them from an IDE like Eclipse or IntelliJ. In Eclipse, try File > Export > General > Ant buildfiles.
Generating an Ant buildfile from a Java program sounds like a monumental task. I would try using an IDE first.
As for you NPE in your Java program, I only know that you should use...
https://ant.apache.org/manual/api/org/apache/tools/ant/Project.html#createTask-java.lang.String-
I don't know if this will clear it up or not. I'm not familiar with the org.apache.tools.ant package and I can't find any documentation on how to use it.
Comal Rajagopalaratnam Muthukumar wrote:
javac ChapterAntProject.java
java ChapterAntProject.class
All things are lawful, but not all things are profitable.
Comal Rajagopalaratnam Muthukumar wrote:
Hi
On another instant when
i used the code with system.out.println(proj1);
the resiult indicates a db id-
**************
ChapterAntProject@1db9742
*************
please tell me what this meansThanks
As
CRMK
All things are lawful, but not all things are profitable.
All things are lawful, but not all things are profitable.
All things are lawful, but not all things are profitable.
All things are lawful, but not all things are profitable.
All things are lawful, but not all things are profitable.
Knute Snortum wrote:I still have the question: what are you trying to do with this code?
All things are lawful, but not all things are profitable.
Knute Snortum wrote:I think I finally know what you're trying to do. Are you trying to write a Java program that can be called from an ant task? If so, it's much simpler than you've made it. The directions are here. My Java class:
And I called it with a build.xml file like this:
Knute Snortum wrote:I think I finally know what you're trying to do. Are you trying to write a Java program that can be called from an ant task? If so, it's much simpler than you've made it. The directions are here. My Java class:
And I called it with a build.xml file like this:
Tim Moores wrote:I guess it's too late now
Knute Snortum wrote:Are you talking about the code in this post? What do you mean by "logging"? The output seems to be exactly what I would expect. What were you expecting and why?
All things are lawful, but not all things are profitable.
Knute Snortum wrote:With a little tweaking, I got ant to "log" (print) to the screen:
What I changed in the build.xml file:
Note that the classname attribute is "mtp.MyTask" because you have a package statement in your Java program.
All things are lawful, but not all things are profitable.
Knute Snortum wrote:There are multiple problems with this code, the first of which is it is improperly formatted. If you indent and format your code correctly, you will see many of the problems.
This is a plain old syntax error. That means you didn't follow the basic rules of coding. It looks like you are trying to make a do/while loop, but there's not "do" part. Also, the condition of the "while" is surrounded with parentheses.
I think you need to abandon this project and do something simpler. Review the basics of Java programming here:
https://docs.oracle.com/javase/tutorial/
All things are lawful, but not all things are profitable.
Knute Snortum wrote:1) Your indentation/formatting really need improvement. Here is the style guide for the CodeRanch Java programs. The only thing I do differently is how I use braces:
Pick a style and stick with it.
2) Remove unnecessary and unused code from you program. All of these lines are unused:
All things are lawful, but not all things are profitable.
Knute Snortum wrote:The formatting is still terrible, but your program seems to do what you want it to.
Tim Moores wrote:You can embed double quotes in Java string litelals by escaping the double quote with a backslash: name=\"MyTask\" instead of name='MyTask'.
Not in its present state it can't. The formatting is really bad. Please format the whole thing correctly and post it again.Comal Rajagopalaratnam Muthukumar wrote:. . . I created java prg as under just to get a style-pattern /specimen sample
that can be developed further . . .
Is this the real life? Is this just fantasy? Is this a tiny ad?
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
|