How to pack a standalone Java application
Hi, all. I have a stand alone Java application which includs some classes and some properties files. Meanwhile, I'm using some libraries(in jar files) from 3rd party as library extension.
When I developed my application in the IDE, I can run it from the IDE and it works fine.
Now I want to run it out of the IDE, it always complains that is can't find the 3rd party classes. I have tried to modify the classpath to include the extension libraries but it goes no avail. What might be the problem?
And normally, how will you pack the application to submit it to the end-users? How do you include the libraries from 3rd party without end-users' awareness?
Thanks a lot!
Put it in a jar, and use the classpath-setting in the jar manifest file.
Or extract the 3rdparty libraries, and put everything in a big jar.
Or provide a .bat-file and a shellscript that sets classpath temporarily.
Similar Messages
-
How to make an standalone java application that uses mysql driver
Hi,
I have an application that makes connection to a mysql database, on my computer, I set on classpath the driver address, so everithing works fine.
The problem is that I want to execute my application from other computers, where the classpath does not have the drivers.
So my question is how can I package the driver? so, everybody can run my application from a Jar, for example.
thanks in advance,
- SusanaNobody answered me, but I post the solution I found, that maybe can help somebody else with this problem:
I packed all my application sources (.class) and the drivers sources (.jar) with the tool: FAT JAR. It is an Eclipse plug-in. And now I can run mi application from the resulting Jar in other machines without installing the conector.
Bye,
- Susana -
How to get Portal user from a standalone Java application
Hi,
I have a standalone Java application from where I need to fetch the Portal User Information like userid and email id.
I am using the below line of code
iUser = UMFactory.getUserFactory().getUserByLogonID("e017939");
I have included the jar file com.sap.security.api , But it was giving me the below exception
java.lang.NoClassDefFoundError: com/sap/tc/logging/Location
at com.sap.security.api.UMFactory.<clinit>(UMFactory.java:55)
at com.am.wcas.java.mailscheduler.kmaccess.FetchDataFromKM.getiUser(FetchDataFromKM.java:29)
at com.am.ScheduleEmails.main(ScheduleEmails.java:89)
and I am getting a pop Up message from the Java Virtual Machine Launcher, saying a Fatal Exception has occured and the Program will exit.
Then I went throught he SDN threads and they asked me to include the
logging.jar and com.sap.security.perm.api .
I Included them, then also, it is giving me Exception
java.lang.NoClassDefFoundError: com/sap/engine/lib/logging/LoggingHelper
at com.sap.security.api.UMFactory.<clinit>(UMFactory.java:56)
at com.am.FetchKMData.main(FetchKMData.java:30)
Exception in thread "main"
and I am getting a pop Up message from the Java Virtual Machine Launcher, saying a Fatal Exception has occured and the Program will exit.
Kindly let me know if it is possible to access the User info using UMFactory in a standalone Java application. If yes kindly let me know where i am going wrong.
Regards,
Shilpa B.VHi Shilpa,
1. Check that you have added com.sap.security.api within the Your Project>Libraries folder (under navigation tab) and also added jars in the build path of the Your Project under project>properties>Build Path.
2. In case you have a DC instead of Web Dynpro Project then you have to add the com.sap.security.api under Your DC>Used DCs and have compile time and runtime dependency added.
Here java.lang.NoClassDefFoundError is caused basically due to only build time dependency added and reference to the jar missing at runtime. Rest the code to retrieve the current user id using UME API and getUserByLogOnID("....") method with/without portal environment would not be an issue at all.
Regards,
Tushar SInha -
To support certficate based client authentication using 2-way SSL from a standalone java application which uses JNDI and JSSE1.0.2 to connect to an SSL enabled LDAP Server how do we configure the certmap.conf?Is there any additional setup required at the LDAP Server side apart from enablinf SSL with the option"Required Client Authentication" enabled.The 2 way SSL handshake goes through but the access log file (After configuring the certmap.conf for the issuer DN of the client certficate etc..)shows SSL failed to LDAP DN?But inspite of this access log error the Java client does get an SSL Connection object with which it is able to connect to the LDAP.IS the certmap.conf file being looked up by the LDAP Server at all?
have you out.flush() and out.close() before you call connection.getInputStream()?
-
How can i get a java application
how can i get a java application on my mac pro?
I'm not sure I understand the question. If the application is a standalone applet, you download it as you would any other application or file. If the applet is embedded in a web site, just go to the appropriate web page.
If you can provide more specifics about what it is you are trying to download/accomplish, perhaps we can be of more specific assistance.
Regards. -
Can we call a webservice using standalone java application ?
Hi friends,
Can we call configurd webservice in xi , using standalone java application by just giving url of webservice ?
OR
Only by means of WEBDynapro we can call ?
Can you please tell me the answer for this .
Regards .,
V.RangarajanHI Ranga Rajan
well, If at all if you have webservice...you can import that werbserivce as External definition in to IR.
How to import:
1) Go to IR and and move to your requied component and there you can see the option called imported objects...select on imported objects where you can give the name and you can select the webservices which you want to use it.
2) Hope you are aware of that a werbservice will have the request and response.
3) Create the mapping program accroding to your requirement.
Go through blogs of Bhavesh and Naveen which talks about calling webservice in a specific condition:
Webservice Calls From a User Defined Function - /people/bhavesh.kantilal/blog/2006/11/20/webservice-calls-from-a-user-defined-function
Consuming/Calling webservices from DataBases - /people/sap.user72/blog/2005/10/20/consumingcalling-webservices-from-databases
Also check this help file on Web Services:
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/336365d3-0401-0010-9884-a651295aeaa9
Cheers..
Vasu
<i>** Reward Points if found useful **</i> -
Accessing JNDI from Standalone JAVA application
Hi,
I want to access the JNDI tree from my
standalone java application. (ie I have
one weblogic server contains all my ejbs and client - swing - application which accesses that. )
Here I don't want to ship weblogic.jar
file to the client with swing application
because it is of ~ 20 MP.
Any other way to specify the INITIAL_CONTEXT_FATORY class.
My code is
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
env.put(Context.PROVIDER_URL, DTEConfig.PROVIDER_URL);
But since I don't want to give the
weblogic.jar bundle to my client, how he
could manage this with out weblogic.jndi.WLInitialContextFactory
with him to get the initialContext ?
-Rajan KumarYou can strip out the jndi related classes from the weblogic.jar which can be distributed
to the client installation. I don't think you will be violating any bea licensing
policies with this.
Rajan Kumar <[email protected]> wrote:
Hi,
I want to access the JNDI tree from my
standalone java application. (ie I have
one weblogic server contains all my ejbs and client - swing - application
which accesses that. )
Here I don't want to ship weblogic.jar
file to the client with swing application
because it is of ~ 20 MP.
Any other way to specify the INITIAL_CONTEXT_FATORY class.
My code is
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
env.put(Context.PROVIDER_URL, DTEConfig.PROVIDER_URL);
But since I don't want to give the
weblogic.jar bundle to my client, how he
could manage this with out weblogic.jndi.WLInitialContextFactory
with him to get the initialContext ?
-Rajan Kumar -
Report Engine SDK - Rbean usage in standalone java application
Post Author: Berndb
CA Forum: JAVA
In BOXI the rebean sdk is available in the Report Engine SDK.
I remember that in the 6.5 world one could use RBEAN interface in a standalone java application.
Is this still possible in BOXI R2?
If yes can you supply a sample classpath which shows all libraries that needs to be assigned.
Thanks in advance.
berndPost Author: datahog
CA Forum: JAVA
Ted's right, but for fun, take what you need from:
<installation drive>:\Program Files\Business Objects\Tomcat\webapps\businessobjects\enterprise115\desktoplaunch\WEB-INF\lib
and de-reference what's not needed when your project's done, but be careful.
I've actually done some standalone Swing-based webi report renderers using https://xhtmlrenderer.dev.java.net/ + docHTMLView.getStringpart + TagSoup -
How can I run a java-application on starting of Windows 2000
How can I run a java-application without any user on starting of Windows 2000?
For example, if the computer is restarted and nobody enter into it yet, my java-application should run anyway.
How can I do that?Hi, you have to put it in a Windows service.
To do this you have a program, Srvany.exe that allow to insert a .exe or .bat program in a Windows service.
For example, i develop a program, TomcatGuardian and i put it in a service because i need to run it in a server without Administrator logged in.
Regards,
Ivan. -
Reading a XML file in a standalone java application
Hi,
What are my options if I have a standalone java application running outside any app. server and I need to read an XML file, probably read some of the attributes in the file...? Please explain clearly as I'm new to this. Appreciate your help.
Thanks,
Mahdadnope you don't need a DTD
you have to write your Java code in a way that doesn't rely too much on the structure:
- avoid getFirstChild().getFirstChild()... because you know that this element is first grandson of that element)
- prefer using getElementByTagName() or some XPath() API
but if the XML completely changes, well, yeah, you have to do some programmation: better think well your document structure in the beginning. -
How to show superscript in ,java application?
how to show superscript in ,java application? in command prompt and using JOptionPane.showMessageDialog()
JOptionPane.showMessageDialog(null,"<html>4<sup>2</sup> = 16</html>");
-
How to send attachments using java application and outlook
Hi ,
I created an application in java which is as
on the Conference Tab i can schedule a conference and with the send command on page it map all the scheduled data to outlook(with all conference details) and using outlook send option the mails are send to appropriate user.
but now i want to modify this application such as when i use the send command from my jsp page it should attach the file that is in .vcs or .ics format for auto updation of user calender.
can any one know how to send attachment using java application .Last time I checked, SMS was a service between carriers and doing SMS yourself was really tricky. Some services existed to let you do it but as I recall they wanted non-trivial money.
However, most phone carriers provide an email-to-SMS bridge of some kind.
So the easiest thing is just to send an email.
That's sending from a non-phone to a phone. There's a J2ME library to send/receive SMS from/to a phone.
However, this is from memory, and a little out of date, so I could be entirely wrong. Hope it helps anyway. -
How can I debug webdynpro java application?
hi,
How can I debug webdynpro java application?
ThanksCheck this document
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/d0cb32c5-36a7-2910-2c9b-ba4a5bbdbb56
Also check this sdn thread Re: DeBugginng The WebDynPro Application particularly shailesh kumar posting
/padmanaban
Edited by: Padmanaban on Sep 26, 2008 1:55 AM -
How can i let my java application closes the other opened windows
how can i let my java application closes the other opened windows: like any other Microsoft Internet Explorer windows ... provided that my java application is not the one i used to open those other windows.... thanks in advance
you'll have to use JNI to access the windowAPI
then you need a list of window handles ... I think there was a function called getWindow and in order to close them you use sendMessage .... for details check out msdn (microsoft developer network)
somwhere I saw a tool called JUtil, which might help you getting started on accessing the win api from java
regards
Spieler -
Standalone java application that calls Db2
Hi,
I am trying to use coherence in my standalone java
application that makes JDBC calls to Db2.
The sql statemet is like below:
select lastName,firstName from employee where empNo=2224;
In the application,I would read from the flat file say
200 account numbers and query the database.
If I have queried the database already with the given
account,I want to retreive from the cache.
I am having real trouble in getting this work with
coherence software.
Any psudo code in this regard will help me a lot.
Thanks
DJonHi Jon,
Thanks for the mail.I am struck in
implementing the coherence in the sample program.
any help in this regard is appreciated.
Thanks
DJon
Below is the sample program that works without coherence.go to db2 and get the information.
import java.sql.*;
import java.util.*;
public class DB2Client
static void printColumn(String in)
System.out.print(in);
System.out.print(" | ");
public static void main(String[] args)
Driver myDriver = null;
Connection myConnection = null;
try
myDriver =
(Driver)Class.forName("com.ibm.db2.jcc.DB2Driver").newInstance();
myConnection =
DriverManager.getConnection("jdbc:db2:sample","dujon","jeff");
PreparedStatement myStatement
= myConnection.prepareStatement("SELECT
empno,firstnme,lastname FROM employee where empno > ?");
myStatement.setString(1,"00");
ResultSet
myResults=myStatement.executeQuery();
while (myResults.next())
printColumn(myResults.getString("empno") + "");
printColumn(myResults.getString("firstnme") + "");
printColumn(myResults.getString("lastname"));
System.out.println();
} catch (Exception e)
e.printStackTrace();
} finally
try
if (myConnection != null)
myConnection.close();
} catch (Exception e)
Now,to implement the above sample with
coherence I have written 2 programs.
1. TangosolDB2Cache.java
2. TestDB2Cache.java
import com.tangosol.net.cache.CacheStore;
import com.tangosol.util.Base;
import java.sql.DriverManager;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
* An example implementation of CacheStore
* interface.
* @author erm 2003.05.01
public class TangosolDB2Cache extends
Base implements CacheStore
// ----- constructors
* Constructs DBCacheStore for a given
database table.
* @param sTableName the db table name
public TangosolJDBCCache(String
sTableName)
m_sTableName = sTableName;
configureConnection();
* Set up the DB connection.
protected void configureConnection()
try
Class.forName("com.ibm.db2.jcc.DB2Driver");
m_con =
DriverManager.getConnection(DB_URL, DB_USERNAME, DB_PASSWORD);
m_con.setAutoCommit(true);
catch (Exception e)
throw ensureRuntimeException(e,
"Connection failed");
// ---- accessors
* Obtain the name of the table this
CacheStore is persisting to.
* @return the name of the table this
CacheStore is persisting to
public String getTableName()
return m_sTableName;
* Obtain the connection being used to
connect to the database.
* @return the connection used to
connect to the database
public Connection getConnection()
return m_con;
// ----- CacheStore Interface
* Return the value associated with the
specified key, or null if the
* key does not have an associated
value in the underlying store.
* @param oKey key whose associated
value is to be returned
* @return the value associated with
the specified key, or
* <tt>null</tt> if no value is
available for that key
public Object load(Object oKey)
Integer iKey = (Integer)key;
return query("select
lastName,firstName from employee where empNo = " + iKey);
* Store the specified value under the
specific key in the underlying
* store. This method is intended to
support both key/value creation
* and value update for a specific key.
* @param oKey key to store the
value under
* @param oValue value to be stored
* @throws
UnsupportedOperationException if this implementation or the
* underlying store is
read-only
public void store(Object oKey, Object
oValue)
mycacheTable(oKey,oValue);
public void erase(Object oKey)
public void eraseAll(Collection
colKeys)
throw new
UnsupportedOperationException();
public Map loadAll(Collection colKeys)
throw new
UnsupportedOperationException();
public void storeAll(Map mapEntries)
throw new
UnsupportedOperationException();
// ----- data members
Hashtable mycacheTable = new Hashtable(1000);
* The connection.
protected Connection m_con;
* The db table name.
protected String m_sTableName;
* Driver class name.
private static final String DB_DRIVER =
"org.gjt.mm.mysql.Driver";
* Connection URL.
private static final String DB_URL =
"jdbc:db2:sample";
* User name.
private static final String DB_USERNAME =
"dujon";
* Password.
private static final String DB_PASSWORD =
"jeff";
TESTING THE ABOVE PROGRAM
import com.tangosol.net.cache.CacheStore;
import com.tangosol.util.Base;
import
com.tangosol.net.cache.MapCacheStore;
import java.sql.DriverManager;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
public class TestDB2Cache {
public static void main(String args[]){
TangosolJDBCCache mycache = new
TangosolDB2Cache("employee");
Connection
con=mycache.configureConnection();
MapCacheStore cacheStuff = new
MapCacheStore(HashMap hmap);
String[] employeeNumbers =
{"000010","000020","000030","000040","000050"};
// find whether it has been cached already
for(int
i=0;i<employeeNumbers.length();i++){
oCurValue =
cacheStuff.load(employeeNumbers);
if(oCurValue == null){
// execute SQL statement
con.executeQuery(oCurKey);
else
//get from cache the values and return
cacheStuff.load(oCurKey);
Maybe you are looking for
-
Hi, After installation of EhP4 and BP for MSS 1.41 the application Team Calendar does not work anymore and there is an error. Team Calendar has not come with the latest packages, but there must be some components that cause the error. When I preview
-
How to get Mashita UJ 825 to work again?
Hi everybody, I am trying to help out a friend who has a 17" iMac (the model before iSight). She is using Panther 10.3.6. Her Optical Drive is a Matshita UJ 825 (I'm not sure about the spelling of Matshita) and it won't accept discs anymore. As soon
-
hi all, how can i create a document library with a managed metadata column and lookup column . what should be the type for managed metadata column ? is it "Taxonomy", if yes how can i enter the term set values which should be populated by default.
-
Apple's own ipad Photos app has hard crashed (kernel panic?) the iPad twice
Not so bad that it has to be reloaded from a backup, but bad enough that it takes forever to boot from the reset. All I did was flick through the photos super fast, and crash.. I have 433 photos BTW.. Others should try it..
-
Upgrading EDGe line and transferring phone to a different line
Hey guys, I currently have one line on the EDGE program that is eligible for an edge upgrade - however, when I upgraded that line to the edge program back in Feb 2014, I did it for use on a different line on my account (basically used another line's