Packaging Additional jars with Midlet jar
How should i package any additional Jar in my Midlet suit. Basically i am using JBuilder 2006 to develop a J2ME applcation and i have installed Nokia Developer suit for Midlet packaging. I thought that by adding the jar files (utility/helping) to res folder would enable me to package them with Midlet jar but it is not hapening. So on emulators my application is running fine as all the jars are in classpath but when i deploy the midlet jar in my cell phone it throws a No Class DEf found error which is logical and correct as no any utility jar is included in the midlet suit.
Please help me to find a solution. I am in a dying stage and has to submit the deliverables by tomorrow.
Thanking in anticipation.
Regards,
Alam Sher
I extract 3rd party JARs and then include them in my JAR as follows:
jar xf jakarta-oro-2.0.5.jar
jar xf jasperreports-1.2.1.jar
jar xf iReport.jar
jar cmf mainClass Spec Remote.jar *.class org/ net/ it/The extraction of jakarta... produces the org/ path, jasperreports... produces the net/ path and iReport ... produces the it/ path. All are in my working directory as are my *.class files. I hope this is the answer you need.
Similar Messages
-
Hello people, let me tell you a little stroy
I'm using netbeans IDE to wrtie a program that uses the mysql connector package to interface with a database. Every time I compile in the IDE, it gives me a nice little command line executable to try. (Something along the lines of
"To run this application from the command line without Ant, try:
java -jar "C:\...path to my jar"
... so I go ahead and try it ...
I'm getting a class not found error. the class its not finding is the connector:
com.mysql.jdbc.Driver
thus, im wondering what the syntax would be to include that in the command line call .... or if there's a better way to run my application with all of the extensions it needs without the IDE.
Thanks in advance ..Sorry, but we have heard that story before...
To run an Java application use:
Usage: java [-options] class [args...]
(to execute a class)
or java [-options] -jar jarfile [args...]
(to execute a jar file)
where options include:
-client to select the "client" VM
-server to select the "server" VM
-hotspot is a synonym for the "client" VM [deprecated]
The default VM is client.
-cp <class search path of directories and zip/jar files>
-classpath <class search path of directories and zip/jar files>
A ; separated list of directories, JAR archives,
and ZIP archives to search for class files.
-D<name>=<value>
set a system property
-verbose[:class|gc|jni]
enable verbose output
-version print product version and exit
-version:<value>
require the specified version to run
-showversion print product version and continue
-jre-restrict-search | -jre-no-restrict-search
include/exclude user private JREs in the version search
-? -help print this help message
-X print help on non-standard options
-ea[:<packagename>...|:<classname>]
-enableassertions[:<packagename>...|:<classname>]
enable assertions
-da[:<packagename>...|:<classname>]
-disableassertions[:<packagename>...|:<classname>]
disable assertions
-esa | -enablesystemassertions
enable system assertions
-dsa | -disablesystemassertions
disable system assertions
-agentlib:<libname>[=<options>]
load native agent library <libname>, e.g. -agentlib:hprof
see also, -agentlib:jdwp=help and -agentlib:hprof=help
-agentpath:<pathname>[=<options>]
load native agent library by full pathname
-javaagent:<jarpath>[=<options>]
load Java programming language agent, see java.lang.instrument -
Replace Orion.jar with Oc4j.jar, Changing the container
Hi
I'll be really appreciate any help.
My application( web-based application based on Forms6i) is working fine with Orion.jar. I would like to upgrade this structure to Oracle9iDS using Oc4j.jar instead of orion. I have a main.jsp ( http://www.bmhub.com) file that after getting username/password, opens another window to show the main menu including all options(forms6i).With "Orion.jar" it works fine, I get message "Login ok" and so on.
I installed Oracle9iDS and I changed application.xml in "C:\oracle\Forms9i\j2ee\Oracle9iDS\config". After starting startinst.bat ( contains oc4j.jar), I entered username/password but I get message that "some fileds are blanks" and "Login Failed". when I changed the oc4j.jar to orion.jar, the sartinst.bat disappeared after 1 second.
Also I tried to replace most of the files in "C:\oracle\Forms9i\j2ee\Oracle9iDS\config" with my old configuration ( Orion configuration), the startinst with orion.jar works fine and I'm able to enter username/password. but nothing more. the forms9i dosent work anymore.(error HTTP 500).
Could you please help me?
regards,Hi,
It seems getParameter() just returns null. I use it in my User.java file to login from main.jsp page.
public void configure(HttpServletRequest request)
setUserName(request.getParameter(User.USER_NAME));
setPassword(request.getParameter(User.PASSWORD));
setCompany(request.getParameter(User.COMPANY));
if ( (request.getParameter(MODE)!=null) && !request.getParameter(MODE).trim().equals(""))
try
setPartnerTypeId(Integer.parseInt(request.getParameter(MODE).trim()));
catch(Exception e)
e.printStackTrace();
How come it works with Orion.jar but returns null with Oc4j.jar?
Thanks, -
Run *jar with other jars in classpath...
Hey,
I am writing a little tool in Java and I exported it into a jar file. My tool uses a jar from somebody else. A second jar so to say...!
My Jar's path is: ~/Desktop/project/dist/lib/MyTool.jar
The other jar is located in: ~/Desktop/project/lib/help.jar
I call the java vm from: ~/desktop/project/exe/
with:
java -cp ../lib/help.jar -jar ../dist/lib/MyTool.jar
Now the tool starts running and everything works fine up to the moment when it is supposed to use one of the classes from the help.jar.
Then I get a java.lang.NoClassDefFoundError.
What am I doing wrong here?
I tried to copy help.jar into the /exe/ dir. --> Did not work!
I tried to copy all of the file into one folder and start the tool from there. --> didn't work.
It would be great if somebody could point my in the right direction on how to solve my problem.
THX
MartinHey,
I am writing a little tool in Java and I exported it
into a jar file. My tool uses a jar from somebody
else. A second jar so to say...!
My Jar's path is:
~/Desktop/project/dist/lib/MyTool.jar
The other jar is located in:
~/Desktop/project/lib/help.jar
I call the java vm from: ~/desktop/project/exe/
with:
java -cp ../lib/help.jar -jar
-jar ../dist/lib/MyTool.jar
Now the tool starts running and everything works fine
up to the moment when it is supposed to use one of the
classes from the help.jar.
Then I get a java.lang.NoClassDefFoundError.
What am I doing wrong here?
I tried to copy help.jar into the /exe/ dir. --> Did
not work!
I tried to copy all of the file into one folder and
start the tool from there. --> didn't work.
It would be great if somebody could point my in the
right direction on how to solve my problem.The classpath argument is ignored when you are running a jar using java -jar some.jar. You have to specify the class path from within the Manifest.
Basic JAR tutorial:
http://java.sun.com/j2se/1.4.1/docs/guide/jar/jar.html
Tutorial about the extension mechanism:
http://java.sun.com/products/jdk/1.2/docs/guide/extensions/spec.html -
Third party dlls and jars with in jars.
Hi,
I have a application which uses several 3rd party jars and dlls.I want to create a executable jar for the application .I added the external jars using fat jar eclipse plugin. Iam able to run the jar on my system successfully.But on other systems the application doesnot launch as the dlls are not avaiable which is fairly understandable. It gives the following exception 'JarClassLoader: Warning: Unable to load native library: java.lang.NullPointerException'.Now i need to include these dlls into the jar so that i can distribute the application as a single jar and launch double clicking it.I know expecting dlls ignores the cross platform nature of java but i need it.please give me some idea on how this can be done.
Thanks in advanceHi,
I have a application which uses several 3rd party jars and dlls.I want to create a executable jar for the application .I added the external jars using fat jar eclipse plugin. Iam able to run the jar on my system successfully.But on other systems the application doesnot launch as the dlls are not avaiable which is fairly understandable. It gives the following exception 'JarClassLoader: Warning: Unable to load native library: java.lang.NullPointerException'.Now i need to include these dlls into the jar so that i can distribute the application as a single jar and launch double clicking it.I know expecting dlls ignores the cross platform nature of java but i need it.please give me some idea on how this can be done.
Thanks in advance -
Create jar with nested jars progammatically
Hello,
I want to create a jar which will contain other (nested) jars, and then I want my main class (inside the created jar) to make use of classes within the nested jars. And all this, I want to do programmatically (e.g. using Runtime.exec()). Is this possible?
Thanks,
Edited by: 925181 on Apr 3, 2012 4:41 AM
Edited by: 925181 on Apr 3, 2012 4:46 AMAnd all this, I want to do programmatically (e.g. using Runtime.exec()).I don't understand this part of the question. What will you be doing with Runtime.exec()?
-
Problem may be with saaj.jar and AXIS,WAS,WSAD
Hi,
I have successfully developed and deployed an EJB using WSAD 5.1.2's WebSphere 5.0 Test Environment. I have even able to access the EJB using UTC(Universal Test Client) in WSAD and by launching the j2ee client module using
WebSphere lauchClient program.
Basically I have below directory structure:
a.ear
--|-----axis.war
-----------|------ lib
--------------------|--- all axis related jars are here
--|-----demoEjb.jar (has java jar dependencies set to axis.war\lib jars
I have now exposed this ejb as web service using AXIS 1.2 RC2 deployed as web module inside WSAD. This web service is properly exposed as web service as I can see it and access its wsdl when I access axis web services.
Now I have written a standalone-outside-wsad web service client that uses AXIS stubs and when I try to consume to this ejb web service I am getting below error.
AxisFault
faultCode: {http://xml.apache.org/axis/}HTTP
faultSubcode:
faultString: (500)Internal Server Error
faultActor:
faultNode:
faultDetail:
{}:return code: 500
Error 500: class org.apache.axis.SOAPPart does not implement interface org.w3c.dom.Document
{http://xml.apache.org/axis/}HttpErrorCode:500
(500)Internal Server Error
at org.apache.axis.transport.http.HTTPSender.readFromSocket(HTTPSender.java:663)
at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:94)
at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:147)
at org.apache.axis.client.Call.invokeEngine(Call.java:2719)
at org.apache.axis.client.Call.invoke(Call.java:2702)
at org.apache.axis.client.Call.invoke(Call.java:2378)
at org.apache.axis.client.Call.invoke(Call.java:2301)
at org.apache.axis.client.Call.invoke(Call.java:1758)
at com.sosnoski.test.DemoBindingStub.getAccountHistory(DemoBindingStub.java:194)
at com.sosnoski.test.Client.query(Client.java:63)
at com.sosnoski.test.Client.main(Client.java:100)
I read somewhere with axis mailing lists that it is problem related to axis's saaj.jar and wsad's websphere 5.0
test environment's webservices.jar so I even replaced my wsad installation's D:\Program Files\IBM\WebSphere Studio\Application Developer\v5.1.2\runtimes\base_v5\lib\webservices.jar with
saaj.jar but this did not help and even I have added an references to saaj.jar usign wsad's websphere 5.0 test environment
environment tab->ws.ext.dirs property and even this did not help.
Can anyone please tell me why is error occurring and how to solve it ?
Thanks & Regards,
Kumar.Yes :-)
At the ear level, set the Classloader mode to PARENT_FIRST and WAR classloader policy to APPLICATION. At the axis web module level, set the Classloader mode to PARENT_LAST
We can colloborate to our future efforts if you can please give your active personal id from which you can respond faster for queries .... -
Unable to find ejb-jar with uri X.jar in ear at c:/Y/split_src
Stack trace is below, but the ejb does exist at the location that the FileNotFoundException states. I've checked that application.xml, org.eclipse.wst.common.component both have the correct name for this dependency.
java.lang.Exception: Exception received from deployment driver. See Error Log view for more detail.
at oracle.eclipse.tools.weblogic.server.internal.DeploymentProgressListener.watch(DeploymentProgressListener.java:190)
at oracle.eclipse.tools.weblogic.server.internal.WlsJ2EEDeploymentHelper.deploy(WlsJ2EEDeploymentHelper.java:506)
at oracle.eclipse.tools.weblogic.server.internal.WeblogicServerBehaviour.publishWeblogicModules(WeblogicServerBehaviour.java:1466)
at oracle.eclipse.tools.weblogic.server.internal.WeblogicServerBehaviour.publishToServer(WeblogicServerBehaviour.java:898)
at oracle.eclipse.tools.weblogic.server.internal.WeblogicServerBehaviour.publishOnce(WeblogicServerBehaviour.java:686)
at oracle.eclipse.tools.weblogic.server.internal.WeblogicServerBehaviour.publish(WeblogicServerBehaviour.java:539)
at org.eclipse.wst.server.core.model.ServerBehaviourDelegate.publish(ServerBehaviourDelegate.java:774)
at org.eclipse.wst.server.core.internal.Server.publishImpl(Server.java:3153)
at org.eclipse.wst.server.core.internal.Server$PublishJob.run(Server.java:345)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)
Caused by: weblogic.application.ModuleException:
at weblogic.ejb.container.deployer.EJBModule.init(EJBModule.java:334)
at weblogic.application.internal.flow.ModuleListenerInvoker.init(ModuleListenerInvoker.java:167)
at weblogic.application.internal.flow.InitModulesFlow.initModule(InitModulesFlow.java:312)
at weblogic.application.internal.flow.InitModulesFlow.initModules(InitModulesFlow.java:325)
at weblogic.application.internal.flow.InitModulesFlow.prepare(InitModulesFlow.java:378)
at weblogic.application.internal.BaseDeployment$1.next(BaseDeployment.java:648)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
at weblogic.application.internal.BaseDeployment.prepare(BaseDeployment.java:191)
at weblogic.application.internal.EarDeployment.prepare(EarDeployment.java:59)
at weblogic.application.internal.DeploymentStateChecker.prepare(DeploymentStateChecker.java:154)
at weblogic.deploy.internal.targetserver.AppContainerInvoker.prepare(AppContainerInvoker.java:60)
at weblogic.deploy.internal.targetserver.operations.ActivateOperation.createAndPrepareContainer(ActivateOperation.java:208)
at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doPrepare(ActivateOperation.java:98)
at weblogic.deploy.internal.targetserver.operations.AbstractOperation.prepare(AbstractOperation.java:217)
at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentPrepare(DeploymentManager.java:747)
at weblogic.deploy.internal.targetserver.DeploymentManager.prepareDeploymentList(DeploymentManager.java:1216)
at weblogic.deploy.internal.targetserver.DeploymentManager.handlePrepare(DeploymentManager.java:250)
at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.prepare(DeploymentServiceDispatcher.java:159)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doPrepareCallback(DeploymentReceiverCallbackDeliverer.java:171)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$000(DeploymentReceiverCallbackDeliverer.java:13)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$1.run(DeploymentReceiverCallbackDeliverer.java:46)
at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:545)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)
Caused by: java.io.FileNotFoundException: Unable to find ejb-jar with uri ***.jar in ear at C:\***\split_src
at weblogic.ejb.spi.EJBJar.<init>(EJBJar.java:81)
at weblogic.ejb.container.deployer.EJBModule.buildClassFinder(EJBModule.java:201)
at weblogic.ejb.container.deployer.EJBModule.init(EJBModule.java:313)Hi Ten,
FYI, just by placing the ejb jar inside EAR project it will not be picked up for deployment. The EJB module has to be defined on EAR Module Assembly, and the steps are:
> EAR Project | Properties, Deployment Assembly - Add EJB module
NOTE: To verify the dependency you could try to export the EAR project to an .ear file. If the exported .ear file bundles ejb jar then deployment should work fine.
As far as the deployment mode, OEPE supports WebLogic Split-source (default) and Exploded archive. In the default split-source mode, the .beabuild.txt contains the mapping to the actual files whereas in exploded archive the files are copied over to deployment staging location.
Steps to modify deployment mode:
> In the server view, right click on server configuration | Properties, select WebLogic | Publishing
Please make sure the ejb module is defined appropriately and let me know if this resolves the issue.
Thanks,
Ram -
Do we need jsf-facelets.jar with JSF2?? Please Help
Hello,
In the VDL Section of this article [http://andyschwartz.wordpress.com/2009/07/31/whats-new-in-jsf-2/#facelets|http://andyschwartz.wordpress.com/2009/07/31/whats-new-in-jsf-2/#facelets]
It says that JSF 2 already has facelets. So do we need facelets jar with jsf2 jars??
I am facing few issues concerning this. Once of them is below.
INFO: Initializing Mojarra 2.0.1 (FCS b02) for context ''
Nov 25, 2009 11:31:48 AM com.sun.faces.config.processor.ApplicationConfigProcessor processViewHandlers
WARNING: JSF1069: Disabling the JSF 2.0 Facelets ViewHandler as an older FaceletViewHandler, com.sun.facelets.FaceletViewHandler, has been explicitly configured. If this is not desired behavior, remove the older FaceletViewHandler and library from your application.
Nov 25, 2009 11:31:48 AM com.sun.faces.config.ConfigManager initializeThanks for responding!- Not sure of Intellij internals, but you should be able to override the default mapping of the URI to some xml resource that describes the tags -
How do I do that? Should I extract the *.tld files from the jsf-impl.jar and put in WEB-INF and then include the path to it in the facelet?
- How were you making the taglib.xml known to the older runtime? The doctype shouldn't make a difference here. -
I just included my test-component.taglib.xml in the web.xml like this and is still the same.
<context-param>
<param-name>javax.faces.FACELETS_LIBRARIES</param-name>
<param-value>/WEB-INF/test-component.taglib.xml</param-value>
</context-param>This is my taglib file. Any thing wrong below?
<?xml version="1.0" encoding="UTF-8"?>
<facelet-taglib xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-facelettaglibrary_2_0.xsd"
version="2.0">
<namespace>http://tahir.components/comp</namespace>
<tag>
<tag-name>test</tag-name>
<component>
<component-type>testComponent</component-type>
<handler-class>com.customcomponent.handler.TestComponentHandler</handler-class>
</component>
</tag>
</facelet-taglib>So when I include the uri in the xhtml file, it says it doesnt recognize the URI. When I add the facelet jar it recognizes it. Not sure whats going on.
Thanks for your time, appreciate it.
Edited by: tz_coder on Nov 27, 2009 7:39 AM -
Hello,
I have been making jar files and using the manif.txt. But today, I have the need to create a executable jar with a package.
eg: com.skp.util
I typed in my manifest.txt
Main-Class: com.skp.util.classname
(and made sure my return was there).
Then I jar cmf manifest.txt test.jar classname.class
But when I run it, I get a class not found error:
Thanks,
What does one need to do differently to get packages to work.I tried that with a very simple class, but it does not appear to work?
When you run the jar do you use the package name there?
Here is all I have, it is simple:
mymanif.txt
Main-Class: com/ddi/ags/convert/showargs
Here is how I am crating the jar
jar cmf mymanif.txt test.jar showargs.class
And I run it like this:
java -jar test.jar
And get this error:
$ java -jar test.jar
Exception in thread "main" java.lang.NoClassDefFoundError: com/ddi/ags/convert/s
howargs
And here is the class:
package com.ddi.ags.convert;
import java.io.*;
import java.util.*;
public class showargs
File log_file = new File("C:/testlog.txt");
public static void main(String[] args) throws Exception {
if (args.length < 1)
System.out.println("args are less than one.");
System.exit(1);
} else {
FileWriter writeit = new FileWriter("C:/testlog.txt", true);
for (int i = 0; i < args.length; i++) {
writeit.write(args[i] + "\n");
System.out.println(args);
writeit.close();
System.out.println("all done with testing."); -
Trying to use ord.jdom package with a jar - it's not working...
Guys, I'm trying to build a Swing app that uses jdom classes and interfaces. I built the app in NetBeans, and to get the jdom packages to work, I had to mount the jdom.jar. Then suddenly, I had no errors using the jdom classes Document, Element, SAXBuilder etc. I have the program running perfectly inside the netbeans interface.
Now, how do I get everything working together in a JAR?
Here's the starts of the respective files:
* CTATool.java
* Created on January 3, 2004, 1:23 PM
package CTATool;
* @author jason_michael_trk
public class CTATool extends javax.swing.JFrame
/** Creates new form CTATool */
public CTATool()
initComponents();...
* FileWriterXML.java
* Created on March 5, 2004, 10:06 AM
package CTATool;
import org.jdom.*;
import org.jdom.output.*;
import java.io.*;
* @author Jason L Michael
public class FileWriterXML
private Document doc;
private FileWriter fw;
private File f;
I need to include in the JAR the org.jdom package. How do I do this?
Here's the manifest I am using cirrently:
Manifest-Version: 1.0
Created-By: NetBeans IDE
Specified-By: CTATool.V2.jarContent
Main-Class: CTATool.CTAToolThe jar includes the CTATool.class file, the FileWriterXML.class file and the jdom.jar.
I'm getting the following errors, when I attempt to execute the CTATool.V2.jar:
java.lang.NoClassDefFoundError: org/jdom/JDOMException
at CTATool.CTATool.saveStatsAndExit(CTATool.java:1457)
at CTATool.CTATool.quitMenuItemActionPerformed(CTATool.java:1450)
at CTATool.CTATool.access$400(CTATool.java:13)
at CTATool.CTATool$5.actionPerformed(CTATool.java:157)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1764)
at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1817)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:419)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:257)
at javax.swing.AbstractButton.doClick(AbstractButton.java:289)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1113)
at javax.swing.plaf.basic.BasicMenuItemUI$MouseInputHandler.mouseReleased(BasicMenuItemUI.java:943)
at java.awt.Component.processMouseEvent(Component.java:5134)
at java.awt.Component.processEvent(Component.java:4931)
at java.awt.Container.processEvent(Container.java:1566)
at java.awt.Component.dispatchEventImpl(Component.java:3639)
at java.awt.Container.dispatchEventImpl(Container.java:1623)
at java.awt.Component.dispatchEvent(Component.java:3480)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3450)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3165)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3095)
at java.awt.Container.dispatchEventImpl(Container.java:1609)
at java.awt.Window.dispatchEventImpl(Window.java:1590)
at java.awt.Component.dispatchEvent(Component.java:3480)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:450)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:197)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:144)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:136)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:99)this is right when the FileWriterXML class is created and ran.
Help??!??Thanks in advance!
chewyI think I figured this out, if it helps anyone...
You have to wrap up all of YOUR classes into a jar, and have a manifest entry that specifies:
Class-Path: jdom.jar
Next, you have to put the two together (I used a self-extracting zip file. It contained MyApp.jar and jdom.jar).
when the client extracts it onto their desktop and double clicks on MyApp.jar, it works perfectly.
I don't think there's an easy way to package the jdom.jar in my jar and make this work.
Hope this helps some other wary traveler!
chewy -
Running executable jar with additional classpath
Hi,
I have specified a classpath entry in my manifest file for library.jar and a main class entry for main.class in my myapp.jar archive.
I can run myapp using
java -jar myapp.jar
when the library.jar is in the same directory like myapp.jar.
Is there a way to put library.jar in another directory and still run myapp with something like
java -classpath /path/to/library.jar -jar myapp.jar
Background:
I want to share library.jar for different jars in different locations and do not want to copy it to all those locations...
NilsIs there a way to put library.jar in another
directory and still run myapp with something like
java -classpath /path/to/library.jar -jar myapp.jar
When you use the -jar option of the java application launcher, the only Classpath that is used is the jar file or the Classpath specified by the Class-Path line in the mainifest of the jar.
http://java.sun.com/j2se/1.5.0/docs/tooldocs/windows/java.html
But, instead of using the -jar option, you can use the -classpath option and include all of the jars, including the jar with the main-method class.
java -classpath /path/to/library.jar;path/to/myapp.jar myapp.jar.MainClass -
How do I jar with the full package info inside the jar file?
I want to jar so the jar tvf shows
dir.path.x.y.z.filename.class, or
dir\path\x\y\z\filename.class
What is the command for this? ThanksGot it, see also
http://forum.java.sun.com/thread.jsp?forum=31&thread=351405
1. Go to higher path
2. jar TargetJarName.jar dir.tree.x.y.z\*.class
3. java -classpath dir.tree.x.y.z -jar TargetJarName.jar <arg>
BTW, dir.tree.x.y.z excludes a.b.c where full DOS path =
a.b.c.dir.tree.x.y.z -
Help with creating jar file and running it ?
Hey guys,
I have a program with a package called classes and a sub-package called classes.mainLib.
I am trying to create a JAR file of the class files in mainLib. There is only one class file in classes and that contains the main method. So this is what i am doing:
1. create a manifest file with: Main-Class: classes.Cars
2. from within the mainLib directory (./program_name/classes/mainLib/) i do this:
jar cvf mainLib.jar manifest ./*.class
3. Then i move this jar file to ./program_name/lib and change directory to ./program name/
4. try to do this: java -jar ./lib/mainLib.jar
But it errors with:
gary@linuxbox:~/java/cars$ java -jar ./lib/mainLib.jar
Failed to load Main-Class manifest attribute from
./lib/mainLib.jar
Any ideas why this is happening. the manifest is included in the jar'ing
Thanks.At a glance, it looks like you are placing only the
class files in the jar and trying to navigate your
classpath to run it. Instead, you have to place ALL
the package folders into the jar from the root of
your package hierarchy and the jar runs anywhere, in
any folder. The packages are INSIDE the jar.
also I see cars/classes in a path you describe ...and
the program seems to wnat classes/Cars ??? Could
this be an additional issue (or am I missing seeing
something about your package structure)?Firstly, i believe all my spelling and cases are correct.
I have the following strcuture:
Cars.class (contains main) : package classes in ./classes directory
All other classes : package classes.mainLib in ./classes/mainLib
I would like to jar ALL files in mainLib but not the class that contains the main method. Is this possible?
I'm not sure how clear i was earlier, hope this is more understandable. -
How to compile and creat JAR with native function
Hi there,
I wrote some native function for J2ME. But it seems like using J2ME wireless Toolkits, we can not compile native function. Is it right?
Is anyone knowing how to compile and make JAR with J2MEWTK or command line?
Thanks,
Merry Christmas!![zack327],
JNI like or native interfaces APIs is not supported in the CLDC/MID Profile 1.0 specification. If you have J2ME code that includes JNI code, the J2MEWTK tool will not compile successfully for you.
To package the compiled code to a MIDlet suite .jar file, use the 'Package' command in the J2MEWTK toolkit. It is found on the top menu bar 'Project' option as item on the dropdown list.
To package the MIDlets into a MIDlet suite .jar file from the command line, you can execute the usual jar file command:
jar cf MyMIDletSuite.jar Midlet.class
You will also need to create a MIDlet .jad Application Descriptor file as well.
HTH.
Allen Lai
Developer Technical Support
SUN Microsystems
http://www.sun.com/developers/support/
Maybe you are looking for
-
Time Capsule in Standalone Mode with Existing Wireless Network
Hi there, I hope someone can help. I'm not quite sure where to post this question, so I hope I am in the right place. Ive found various posts on this matter but just would like some assistance with my personal set up. I have a new retina MacBook Pro
-
How do I get rid of a movie downloaded that was bought from iTunes .I hired Amistad but had insuffient to downloaded so I bought extra GB @ £2.99 a month .I got rid of my apps on the hope I could delete it but the same again insuffient storage.So
-
Function tuterial - Mapping columns in Query of DI
Hi friends I searched Internet to find a good tutorial to help me to write functions in DI, but couldn't find any. I need to write rules for mapping columns in Mapping Section of my query object, but honestly as I don't have a sample or tuterial , I'
-
In Acrobat 8, I was able to justify a form field to left, center, or right and also vertically justify the field box to either top, center, or bottom. Right now, all my form fields are vertically centered. I want teh form field when filled to be bo
-
Initialization parameters not getting populated correctly during DBCA
This problem is observed on Oracle 10.2.0.1 Linux x86 and RedHat Enterprise Linux 4 ES Update 5. I tried to use DBCA template file to create an Oracle database (see below for the template file content). The DB creation was successful, but the initial