Solved

java ant project

Posted on 2014-07-31
12
595 Views
Last Modified: 2014-08-10
Hi,

I am trying below example

http://ant.apache.org/manual/tutorial-HelloWorldWithAnt.html

I am not clear on what to do after compiling as below.

Creating a jar-file is not very difficult. But creating a startable jar-file needs more steps: create a manifest-file containing the start class, creating the target directory and archiving the files.

echo Main-Class: oata.HelloWorld>myManifest
md build\jar
jar cfm build\jar\HelloWorld.jar myManifest -C build\classes .
java -jar build\jar\HelloWorld.jar


like which jar i supposed to create etc?
please advise
0
Comment
Question by:gudii9
  • 7
  • 4
12 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 40232049
The commands which you've just posted create a startable  jar file
0
 
LVL 7

Author Comment

by:gudii9
ID: 40236764
what is difference between startable jar and regular jar. why are they using startable jar in this example.

Please advise
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 40236778
A startable jar is one that contains an application, which is startable by running the jar
0
 
LVL 7

Author Comment

by:gudii9
ID: 40237627
I am not very clear on above link as the steps seems not detailed to me. Is there is any simple complete step by step example using eclipse. please advise
0
 
LVL 86

Accepted Solution

by:
CEHJ earned 500 total points
ID: 40237679
That IS step by step (or it wouldn't work)
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
LVL 7

Author Comment

by:gudii9
ID: 40242346
i will try all the steps.
0
 
LVL 7

Author Comment

by:gudii9
ID: 40252112
package jms;

import java.util.Properties;

import javax.jms.*;
import javax.naming.Context;
import javax.naming.InitialContext;

public class ConsumerTwo {
	public ConsumerTwo() {
		try {
			Properties props = new Properties();
			props.setProperty(Context.INITIAL_CONTEXT_FACTORY,
					"org.apache.activemq.jndi.ActiveMQInitialContextFactory");
			props.setProperty(Context.PROVIDER_URL, "tcp://localhost:61616");
			Context context = new InitialContext(props);
			QueueConnectionFactory tcf = (QueueConnectionFactory) context
					.lookup("ConnectionFactory");
			QueueConnection conn = tcf.createQueueConnection();
			conn.start();
			QueueSession session = conn.createQueueSession(false,
					Session.CLIENT_ACKNOWLEDGE);
			Queue queue = (Queue) context.lookup("dynamicQueues/Movies");
			QueueReceiver reciever = session.createReceiver(queue);
			reciever.setMessageListener(new MyListener());
			conn.close();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	public static void main(String[] args) {
		new ConsumerTwo();
	}
}

Open in new window


I wrote one other consumer (ConsumerTwo) and ran in debug mode by putting breakpoint that is also reading on the same queue same old messages(after line 25 at line 26) as they were not deleted by old Consumer.java when i ran as java application, Please advise
0
 
LVL 7

Author Comment

by:gudii9
ID: 40252138
My example running fine from eclipse but when i run Producer.java from command prompt getting below errors.

C:\Users\ganesha\kepler_workspace\05122014_JMS\SpringJMSDemo\src\main\java\jms>
avac producer.java
producer.java:4: error: package javax.jms does not exist
import javax.jms.*;
^
producer.java:16: error: cannot find symbol
                        QueueConnectionFactory tcf = (QueueConnectionFactory) c
ntext
                        ^
  symbol:   class QueueConnectionFactory
  location: class Producer
producer.java:16: error: cannot find symbol
                        QueueConnectionFactory tcf = (QueueConnectionFactory) c
ntext
                                                      ^
  symbol:   class QueueConnectionFactory
  location: class Producer
producer.java:18: error: cannot find symbol
                        QueueConnection conn = tcf.createQueueConnection();
                        ^
  symbol:   class QueueConnection
  location: class Producer
producer.java:20: error: cannot find symbol
                        QueueSession session = conn.createQueueSession(false,
                        ^
  symbol:   class QueueSession
  location: class Producer
producer.java:21: error: cannot find symbol
                                        Session.CLIENT_ACKNOWLEDGE);
                                        ^
  symbol:   variable Session
  location: class Producer
producer.java:22: error: cannot find symbol
                        Queue queue = (Queue) context.lookup("dynamicQueues/Mov
es");
                        ^
  symbol:   class Queue
  location: class Producer
producer.java:22: error: cannot find symbol
                        Queue queue = (Queue) context.lookup("dynamicQueues/Mov
es");
                                       ^
  symbol:   class Queue
  location: class Producer
producer.java:23: error: cannot find symbol
                        QueueSender sender = session.createSender(queue);
                        ^
  symbol:   class QueueSender
  location: class Producer
producer.java:25: error: cannot find symbol
                        TextMessage msg1 = session.createTextMessage();
                        ^
  symbol:   class TextMessage
  location: class Producer
10 errors

C:\Users\ganesha\kepler_workspace\05122014_JMS\SpringJMSDemo\src\main\java\jms>


How to resolve them. Please advise
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 40252154
You need to set the classpath properly for all the packages you're using
0
 
LVL 7

Author Comment

by:gudii9
ID: 40252158
i am trying topic example by creating publisher in one instance of eclipse in workspace called XYZ
and subscriber on other isntance of eclipse in workapce called abc

so that when i publish some messages i want my subscrier automatically notified and get those messages.

workspace abc is not able to understand imports like
import javax.jms.* etc

I looked below url to get the jars
http://www.fluffycat.com/Java/JMS-With-A-Queue/

there are no jars. Any simple complete example on this with all needed jars on both queue, topic, point to point, pub-sub, durable-non durable topics using eclispe and apache mq. please advise
0
 
LVL 7

Author Comment

by:gudii9
ID: 40252167
when i run topic subscriver from flugycat link getting below error
http://www.fluffycat.com/Java/JMS-With-A-Topic/

Naming Exception: javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file:  java.naming.factory.initial
Exception in thread "main" java.lang.NullPointerException
      at jmsTopic.WeasleyQuidditchTopicSubscriber.<init>(WeasleyQuidditchTopicSubscriber.java:53)
      at jmsTopic.WeasleyQuidditchTopicSubscriber.main(WeasleyQuidditchTopicSubscriber.java:17)



Please advise
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
mockito example issue 8 62
Error trying to install RTMT Win7 5 41
oracle 11g 23 50
type mismatch (Object[] to double[] 4 8
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

896 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now