Problem using ant to create a jar...
Hi,
I am trying to create a JAR, and amongst other things include in that a directory called docs. I would like both the directory and its contents included, not just the contents.
I can get this to work, but when using a property it doesn't!
Within my jar task
<fileset dir=".">
<include name="doc/**"/>
</fileset>will work just fine. However,
<fileset dir=".">
<include name="${doc}/**"/>
</fileset>will not do anything, with doc defined as:
<property name="doc" location="doc" />Does anyone have any ideas? Many thanks.
Yes, that's pretty standard code (except you don't need the .newInstance() just loading the class does it).
I haven't experimented much with Class-Path in jars, but I still think a ClassLoader problem is the most likely cause. Try something like this:
try {
Class driverClass = Thread.currentThread().getContextClassLoader().loadClass("com.mysql.jdbc.Driver");
Driver driver = (Driver)driverClass.newInstance();
java.util.Properties conProps = new java.util.Properties();
conProps.setProperty("user", "root");
conProps.setProperty("password", "");
dbConnection = driver.connect("jdbc:mysql://127.0.0.1/bdd/", conProps);
catch(ClassNotFoundException) {
....(Of course I might be way off track, and we might have missed something simpler).
Similar Messages
-
Problem using BAPI_BUS2001_CREATE to create project definition
Hi,
i have a problem using BAPI_BUS2001_CREATE to create project definition.
i have customer fields in CI_PROJ structure.
i used help structure BAPI_TE_PROJECT_DEFINITION in EXTENSIONIN table
the problem is that customer fields that i have populated in BAPI_TE_PROJECT_DEFINITION are not processed.
please help.
thanks.solved,
applay oss note 637345 -
Using ANT to create config.xml template
Does anyone have an example on how to use ant to create a config.xml template?
try this:
<target
description="Creates the config.xml file from the config-template.xml file"
name="parseConfigXML">
<copy
file="config-template.xml"
tofile="config.xml"
overwrite="true"
/>
<replace
file="config.xml"
value="defaultvalue"
replacefilterfile="local.configtemplate.properties">
</replace>
<antcall target="parseSetDomainEnv" />
</target> -
Problem using BAPI to create Service Confirmation in CRM
Good afternoon all.
I have raised this is CRM forum too, just thought it best to ask the broader ABAP community the question too.
We are encountering a problem using a BAPI to create a transaction in CRM, specifically:
I am trying to create a Service Confirmation (BUS2000117) in a CRM system using the BAPI BAPI_BUSPROCESSND_CREATEMULTI.
The BAPI succeeds in creating the header of the transaction, but I cannot make the BAPI create any other data in the transaction such as partners or items.
Just want to be sure that I am not being foolish...has anyone succeeded in using this BAPI to create an error-free Service Confirmation?
Regards
NickI am going to pop this thread into General ABAP forum too.
Nick -
Problem using ant 1.6.2 scripts for weblogic 8.1
hai,
i downloaded ant 1.6.2 and started writting ant scripts. these ran fine when i am doing jobs related to websphere application server but they are failing when i am running the same targets in weblogic.
i know that this problem is mainly due to the old version of inbuilt ant provided by the weblogic.
i use import,input,condition tasks in my code and when ever run the ant scripts in weblogic its saying that these targets can not be found.
i am in great need for help, any one please help me how to make these newer version of ant scripts to work in weblogic.i have no choice but to use these tasks as the design requires using them.
i will be greatly indebted to the replier as i am wasting lot of time for this.Hello,
I could not find an easy way to get the wls version of ant to start using the tasks you mention from ant 1.6.2.
I tried defining the tasks using taskdef and also adding them to wls ant.jar and updating the deafult.properties file but the ant complained about unexpected elements in the build.xml file where I added the new tags (e.g import)
If your really up against it you can try adding wls tasks to ant 1.6.2, they are listed here:
http://e-docs.bea.com/wls/docs81/toolstable/ToolsTable.html#1009580
Although I could not located exactly which jar they are in. Good luck.
Cheers
Hussein Badakhchani
www.orbism.com -
Error while trying to use Ant and creating Jdbc Datasource
I was following the documentation to auto-create my datasource in my weblogic server. I get an error while it is trying to link the datasource to the server. Does anybody have any ideas,it is almost like the query to get the server isn't working.
Here is my ant task:
<target name="setupJdbcDatasource">
<wlconfig url="t3://localhost:7001" username="weblogic" password="weblogic">
<query domain="MyDomain" type="Server" name="AdminServer" property="adminserver"/>
<create type="JDBCConnectionPool" name="TestDatasource" property="DatasourceTest">
<set attribute="CapacityIncrement" value="1"/>
<set attribute="DriverName" value="weblogic.jdbcx.oracle.OracleDataSource"/>
<set attribute="InitialCapacity" value="1"/>
<set attribute="MaxCapacity" value="10"/>
<set attribute="Password" value="cmuser"/>
<set attribute="Properties" value="user=cmuser SID=ORCH serverName=10.13.5.144 portNumber=1521"/>
<set attribute="RefreshMinutes" value="0"/>
<set attribute="ShrinkPeriodMinutes" value="15"/>
<set attribute="ShrinkingEnabled" value="true"/>
<set attribute="TestConnectionsOnRelease" value="false"/>
<set attribute="TestConnectionsOnReserve" value="false"/>
<set attribute="URL" value="jdbc:bea:oracle://10.13.5.144:1521"/>
<set attribute="Targets" value="${adminserver}"/>
</create>
</wlconfig>
</target>
My Domain is MyDomain, and server is AdminServer. The error I get is:
[wlconfig] weblogic.management.DistributedManagementException : Distributed Management [1 exceptions]
BUILD FAILED
X:\ibutt_PCView\src\CM\build.xml:285: Error invoking MBean
command: javax.management.MBeanException
And in my server log:
jdbcDataSourceBean=[MBeanServerInvocationHandler]com.bea:Name=CP-ConfigManagemen
tTest,Type=weblogic.j2ee.descriptor.wl.JDBCDataSourceBean,Parent=[MyDomain]/JDBC
SystemResources[CP-ConfigManagementTest],Path=JDBCResource
<May 21, 2006 3:50:57 PM EDT> <Warning> <JDBC> <BEA-001129> <Received exception
while creating connection for pool "ConfigManagementTest": [BEA][Oracle JDBC Dri
ver]Missing connection information: no serverName specified.>
<May 21, 2006 3:50:58 PM EDT> <Error> <Deployer> <BEA-149265> <Failure occured i
n the execution of deployment request with ID '1148241051441' for task 'weblogic
.deploy.configChangeTask.2'. Error is: 'weblogic.application.ModuleException: '
weblogic.application.ModuleException:Hi. This seems like an XML parsing problem.
Could you please try changing the driver
properties from:
<set attribute="Properties" value="user=cmuser SID=ORCH serverName=10.13.5.144 portNumber=1521"/>
to:
<set attribute="Properties" value="user=cmuser SID=ORCH"/>
The server and port are already in the URL
thanks,
Joe -
Problem using ant and weblogic web services (jwsc)
I have made a small HelloWorld implementation as given in http://download.oracle.com/docs/cd/E12840_01/wls/docs103/webserv/use_cases.html#wp228687. but when I run ant I get this error
Buildfile: build.xml
build-service:
[jwsc] JWS: processing module /examples/webservices/hello_world/HelloWorldImpl
[jwsc] Parsing source files
[jwsc] Parsing source files
[AntUtil.deleteDir] Deleting directory /tmp/_gwf3vm
BUILD FAILED
/home/testprojects/src/build.xml:10: java.lang.RuntimeException: Unknown javadoc problem: result=1, root=null:
JAM: error - Cannot find doclet class com.bea.util.jam.internal.javadoc.JavadocRunner_150
1 error
Any help?I also faced the same problem what I did is
moved all the files from weblogic ant directory into another folder
and ant*.* from c:\bea\weblogic81\server\bin to a temp location
copied all the jar files from apache-ant-1.6.3\lib to beahome\lib\ant folder
copied all the ant*.* files from apache-ant-1.6.3\bin to c:\bea\weblogic81\server\bin directory
now I ran the ant -version I am getting the latest version
try this -
Is anyone having problems using AAMEE to create CS5.5 deploy packages?
I am able to create a deploy package without an issue. SN gets verfied so I know its not that eventhough it's getting the pre-chrome license error in the log files. I looked at the directions that Adobe gives for the pre-chrome error and the only way I can do a silent install is by enabling the built-in Administrator account, logging to that account and running silent command from there. Thats really not a fix when you have 10,000 computer to deploy to. Anyone have the workaround for this?
Thank you! But I've tried that already and still I'm having problems, Apple support has been looking into it, but so far nothing. Thanks again
-
Problem using Automator to create "Watermark PDF Documents"
After having updated our macs from Mavericks to Yosemite, the "Watermark PDF Documents" using Automator is no longer working.
Hi Miykael,
Do you have flash player installed on your system for that browser? Did you tried accessing that pdf file from a different browser?
I would also recommend you to refer this KB Document : https://helpx.adobe.com/acrobat/using/display-pdf-browser-acrobat-xi.html
Regards,
Rahul -
Problem in Creating a jar file using java.util.jar and deploying in jboss 4
Dear Techies,
I am facing this peculiar problem. I am creating a jar file programmatically using java.util.jar api. The jar file is created but Jboss AS is unable to deploy this jar file. I have also tested that my created jar file contains the same files. When I create a jar file from the command using jar -cvf command, Jboss is able to deploy. I am sending the code , please review it and let me know the problem. I badly require your help. I am unable to proceeed in this regard. Please help me.
package com.rrs.corona.solutionsacceleratorstudio.solutionadapter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.util.jar.JarEntry;
import java.util.jar.JarOutputStream;
import java.util.jar.Manifest;
import com.rrs.corona.solutionsacceleratorstudio.SASConstants;
* @author Piku Mishra
public class JarCreation
* File object
File file;
* JarOutputStream object to create a jar file
JarOutputStream jarOutput ;
* File of the generated jar file
String jarFileName = "rrs.jar";
*To create a Manifest.mf file
Manifest manifest = null;
//Attributes atr = null;
* Default Constructor to specify the path and
* name of the jar file
* @param destnPath of type String denoting the path of the generated jar file
public JarCreation(String destnPath)
{//This constructor initializes the destination path and file name of the jar file
try
manifest = new Manifest();
jarOutput = new JarOutputStream(new FileOutputStream(destnPath+"/"+jarFileName),manifest);
catch(Exception e)
e.printStackTrace();
public JarCreation()
* This method is used to obtain the list of files present in a
* directory
* @param path of type String specifying the path of directory containing the files
* @return the list of files from a particular directory
public File[] getFiles(String path)
{//This method is used to obtain the list of files in a directory
try
file = new File(path);
catch(Exception e)
e.printStackTrace();
return file.listFiles();
* This method is used to create a jar file from a directory
* @param path of type String specifying the directory to make jar
public void createJar(String path)
{//This method is used to create a jar file from
// a directory. If the directory contains several nested directory
//it will work.
try
byte[] buff = new byte[2048];
File[] fileList = getFiles(path);
for(int i=0;i<fileList.length;i++)
if(fileList.isDirectory())
createJar(fileList[i].getAbsolutePath());//Recusive method to get the files
else
FileInputStream fin = new FileInputStream(fileList[i]);
String temp = fileList[i].getAbsolutePath();
String subTemp = temp.substring(temp.indexOf("bin")+4,temp.length());
// System.out.println( subTemp+":"+fin.getChannel().size());
jarOutput.putNextEntry(new JarEntry(subTemp));
int len ;
while((len=fin.read(buff))>0)
jarOutput.write(buff,0,len);
fin.close();
catch( Exception e )
e.printStackTrace();
* Method used to close the object for JarOutputStream
public void close()
{//This method is used to close the
//JarOutputStream
try
jarOutput.flush();
jarOutput.close();
catch(Exception e)
e.printStackTrace();
public static void main( String[] args )
JarCreation jarCreate = new JarCreation("destnation path where jar file will be created /");
jarCreate.createJar("put your source directory");
jarCreate.close();Hi,
I have gone through your code and the problem is that when you create jar it takes a complete path address (which is called using getAbsolutePath ) (when you extract you see the path; C:\..\...\..\ )
You need to truncate this complete path and take only the path address where your files are stored and the problem must be solved. -
Problem compiling in Linux using ant
Hi,
I have a problem using ant in Linux.
When I build my application using ant in Windows it works fine, but when I try to build the same application with ant in Linux it gives me the following exception:
/identifier/MidiReader.java:5: error: Class or interface `javax.sound.midi.Sequence' not found in import.
I have already checked and the 'javax.sound.midi.Sequence' exists in import.
Can anybody help me?
Regards,
DavidIn your javac task (in Ant), you need to explicitly include any external JAR's required for compilation (see ant.apache.org's docs for info). Importing them in a Java source file does not tell Ant where to locate the JAR for linking.
- Saish
"My karma ran over your dogma." - Anon -
Need build.xml to create Ear file using Ant in jdeveloper 11g??
Hi all,
I think Jdeveloper use ANT to create Ear file and how to get build.xml from Jdeveloper.
1) I have created ADF Fusion web Application having separte Model and View Controller.
2) Now when I select View Controller project and then i create New ant-> Build.xml i get the required build.xml which can be used to create war file for my View Controller project.
3) Similarly when I select Model project and then i create New ant-> Build.xml i get the required build.xml which can be used to create Jarfile for my Model project.
4) If I select my application and then i click deploy... I'm able to create my ear file having both war file for View Controller and Jar File for Model.
5) But I dont know how to get built.xml file which will create ear file having both View Controller and Model in it.
Thanks a lot....However note the generated Ant script includes unnecessary targets. See the following blog post: http://one-size-doesnt-fit-all.blogspot.com/2010/11/using-ojdeploy-and-ant-for-creating-adf.html
CM. -
Hello all. I am trying to create a jar file for a *"hello world"* program. I compiled the code using netbeans and created the jar file from the HelloWorld.class. I added the main class to the manifest with the following line
Main-Class: helloworld.HelloWorld
Ensured there was a carriage return just before the end of the file.
When I run the program I get the following error:
h1Exception in thread "main" java.lang.NoClassDefFoundError: helloworld/HelloWorld*
Please helpI tried the last command it produced this error
*C:\Documents and Settings\oshonowo\My Documents\Projects\DOS>set JAVA_HOME=c:/Pr
ogram Files/Java/jdk1.6.0_03
C:\Documents and Settings\oshonowo\My Documents\Projects\DOS>set classpath=C:\Pr
ogram Files\Java\jdk1.6.0_03\lib\;C:\Program Files\Java\jre1.6.0_03\lib\ext\QTJa
va.zip;C:\Program Files\Java\jdk1.6.0_03\jre\lib;C:\Program Files\Java\jre1.6.0_
03\lib;%CLASSPATH%;.;C:\Documents and Settings\oshonowo\HelloWorld\build\classes
\helloworld\Hello.jar
C:\Documents and Settings\oshonowo\My Documents\Projects\DOS>"c:/Program Files/J
ava/jdk1.6.0_03\bin\java" helloworld.HelloWorld
Exception in thread "main" java.lang.NoClassDefFoundError: helloworld/HelloWorld
C:\Documents and Settings\oshonowo\My Documents\Projects\DOS>pause
Press any key to continue . . .*
Please help -
Using Ant to execute WLST setAppMetadataRepository command
I am having a problem using Ant to execute the setAppMetadataRepository WLST command. This command puts an entry in adf-config.xml that points to the MDS datasource.
This is the ant task that I'm using. These commands work from the WLST tool, but when using them with Ant, I get the error below.
<target name="setAppMetadataRepositoryUsingWlst">
<wlst debug="true" failonerror="true">
<script>
archive = getMDSArchiveConfig(fromLocation='C:/ADE/michande_platSavedSearch/commsplatform/ri/dist/comms-ri.ear')
archive.setAppMetadataRepository(repository='mds-commsRepository',partition='riPartition', type='DB', jndi='jdbc/mds/commsRepository')
archive.save()
</script>
</wlst>
</target>Here is the error that I get (NameError: getMDSArchiveConfig). This is saying that getMDSArchiveConfig isn't a recognized command. Other commands (like connect(...)) work ok from ant, but not these MDS commands. Is this a bug or am I doing something wrong here?
[wlst] <WLSTTask> All lines will be trimmed by 12
[wlst] <WLSTTask> Line: archive = getMDSArchiveConfig(fromLocation='C:/ADE/michande_platSavedSearch/commsplatform/ri/dist/comms-ri.ear'). Final trim length: 12, String length: 124
[wlst] <WLSTTask> Line: archive.setAppMetadataRepository(repository='mds-commsRepository',partition='riPartition', type='DB', jndi='jdbc/mds/commsRepository') . Final trim length: 12,
String length: 147
[wlst] <WLSTTask> Line: archive.save(). Final trim length: 12, String length: 26
[wlst] <WLSTTask> The script that will be executed
[wlst] archive = getMDSArchiveConfig(fromLocation='C:/ADE/michande_platSavedSearch/commsplatform/ri/dist/comms-ri.ear')
[wlst] archive.setAppMetadataRepository(repository='mds-commsRepository',partition='riPartition', type='DB', jndi='jdbc/mds/commsRepository')
[wlst] archive.save()
[wlst]
[wlst] Error: Error executing the script snippet
[wlst] archive = getMDSArchiveConfig(fromLocation='C:/ADE/michande_platSavedSearch/commsplatform/ri/dist/comms-ri.ear')
[wlst] archive.setAppMetadataRepository(repository='mds-commsRepository',partition='riPartition', type='DB', jndi='jdbc/mds/commsRepository')
[wlst] archive.save()
[wlst]
[wlst] due to:
[wlst] Traceback (innermost last):
[wlst] File "<string>", line 1, in ?
{color:red} [wlst] NameError: getMDSArchiveConfig{color}
Thanks,
MikeNot all WLST installations are equivalent. Have a read of [http://www.oracle.com/technetwork/articles/adf/part10-085778.html]this, specifically the paragraph right after Figure 13 for something to try. Bottom line - the WLST that comes with the base WLS server install cannot do the MDS operations.
John -
I made a simple calculator in java and I want to zip it up in an excutable jar file. I have 3 classes including my main in my .java file and am having trouble creating the jar archive. The source code for this program is:
import java.awt.*;
import java.awt.event.*;
import java.io.File;
import javax.swing.*;
// Frame for button panel
class CalculatorFrame extends JFrame
public CalculatorFrame()
Toolkit kit = Toolkit.getDefaultToolkit();
// sets title & icon image for window
setTitle("Java Calculator v1.0 by D. Burkland");
Image img = kit.getImage("calc.gif");
setIconImage(img);
// add panel to frame
CalculatorPanel calculator = new CalculatorPanel();
add(calculator);
pack();
// centers frame
Dimension screenSize = kit.getScreenSize();
int screenHeight = screenSize.height;
int screenWidth = screenSize.width;
// center & set dimensions of frame
setSize(width, height);
setLocation(screenWidth / 3, screenHeight / 3);
// set file chooser
chooser = new JFileChooser();
chooser.setCurrentDirectory(new File("."));
// set up menu bar
JMenuBar menuBar = new JMenuBar();
setJMenuBar(menuBar);
JMenu filemenu = new JMenu("File");
JMenu helpmenu = new JMenu("Help");
menuBar.add(filemenu);
menuBar.add(helpmenu);
// action of the exit text
JMenuItem exitItem = new JMenuItem("Exit");
filemenu.add(exitItem);
exitItem.addActionListener(new
ActionListener()
public void actionPerformed(ActionEvent event)
System.exit(0);
JMenuItem helpItem = new JMenuItem("About");
helpmenu.add(helpItem);
helpItem.addActionListener(new
ActionListener()
public void actionPerformed(ActionEvent event)
JOptionPane.showMessageDialog(null, "Java Calculator By: D. Burkland Summer 2006");
public static final int width = 350;
public static final int height = 200;
private JFileChooser chooser;
// Calculator panel
class CalculatorPanel extends JPanel
public CalculatorPanel()
setLayout(new BorderLayout());
result = 0;
lastCommand = "=";
start = true;
// add the display
display = new JButton("Hello");
display.setEnabled(false);
add(display, BorderLayout.NORTH);
ActionListener insert = new InsertAction();
ActionListener command = new CommandAction();
// adds the buttons in a 4 x 4 grid
calculator = new JPanel();
calculator.setLayout(new GridLayout(4, 4));
addButton("7", insert);
addButton("8", insert);
addButton("9", insert);
addButton("/", command);
addButton("4", insert);
addButton("5", insert);
addButton("6", insert);
addButton("*", command);
addButton("1", insert);
addButton("2", insert);
addButton("3", insert);
addButton("-", command);
addButton("0", insert);
addButton(".", insert);
addButton("=", command);
addButton("+", command);
add(calculator, BorderLayout.CENTER);
Adds a button to the center panel
@param lable the button label
@param listener the button listener
private void addButton(String label, ActionListener listener)
JButton button = new JButton(label);
button.addActionListener(listener);
calculator.add(button);
// Inserts the button action string to the end of the display
private class InsertAction implements ActionListener
public void actionPerformed(ActionEvent event)
String input = event.getActionCommand();
if (start)
display.setText("");
start = false;
display.setText(display.getText() + input);
// Executes the command that the button action string demotes
private class CommandAction implements ActionListener
public void actionPerformed(ActionEvent event)
String command = event.getActionCommand();
if (start)
if (command.equals("-"))
display.setText(command);
start = false;
else
lastCommand = command;
else
calculate(Double.parseDouble(display.getText()));
lastCommand = command;
start = true;
// Carries out the pending calculation
public void calculate(double x)
if (lastCommand.equals("+")) result += x;
else if (lastCommand.equals("-")) result -= x;
else if (lastCommand.equals("*")) result *= x;
else if (lastCommand.equals("/")) result /= x;
else if (lastCommand.equals("=")) result = x;
display.setText("" + result);
private JButton display;
private JPanel calculator;
private double result;
private String lastCommand;
private boolean start;
public class Calculator
public static void main(String[] args)
CalculatorFrame calculator = new CalculatorFrame();
calculator.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
calculator.setVisible(true);
}I am using Eclipse to create the jar files so if anybody has any advice I would be very grateful if you shared it.
Thanks,
DannyWell I keep getting errors so I am doing something wrong. The errors I get are:
java.io.FileNotFoundException: jarexample.jar (The system cannot find the file specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:
106)
java.io.FileInputStream.<init>(FileInputStream.java:66)
at sun.tools.jar.Main.run(Main.java:122)
at sun.tools.jar.Main.main(Main.java:903)So I have 3 classes, but after compiling the program I have many .class files: Calculator.class, CalculatorFrame$1.class, CalculatorFrame$2.class, CalculatorFrame.class, CalculatorPanel$CommandAction.class, CalculatorPanel$InsertAction.class, and CalculatorPanel.class. Which files do I want to export into my jar file and do I have to open these class files in Eclipse? Also could you explain the manifest thing first, I have googled for this stuff but get confused because of the class file issue that I previously stated.
Thanks again for helping a noobie out :)
Message was edited by:
danny9894
Message was edited by:
danny9894
Maybe you are looking for
-
Can my client add a link when editing text with the content management of Business Catalyst?
I created a site using Muse. My client chose to host with BC and take advantage of the content management option. She has edited text to include her email and wants to create a hyperlink from that text to her actual email. Is this possible and if so,
-
How to invite a friend to play games in Game Center
just updated my iPhone 4 to iOS4.1, I have 3 games in the game center. (Fieldrunners, Flight control, and World series of poker). My friend also has the same three games in her game center. We can see each other in the game center. But cannot invite
-
hi, my scenario is conversion of file to xml where the input is a fixed length file.while conversion im getting the following error.Can anyone help me identify what is it. the i/p structure is datetype datainp header0
-
Hi!!! I have a dude. When I use select round((9013.99/12)*6,2) from dual; the result is 4506.99. Why?? I think it should be 4507. Is it a problem with sqlplus? or I should set a parameter? Regards.
-
Bug ACR 7.2 adjustment brush previews
I realize this is a redundant post - I want to make sure someone at Adobe notices. Adjustment brush previews are turning off when you hover the cursor over the edit pin, and stay off until off until you hover cursor over another pin. Neil Carboni