OC4J - Adding jars to classpath
Hi,
Ive tried adding a new jar to oc4js classpath. Our application depends on this jar.
I couldnt.
Ive tried adding the jar as a 'library-path' tag within the server.xml. Then added it to the command line running oc4j ( -cp = .... ). It didnt do the trick.
Ive only made some progress when putting it straight into oc4js lib directory.
Im confused.
1. What does the 'library-path' tab enable?
2. Whats the difference between using it and supplying jars to the oc4js runtime classpath ( -cp ).
3. What is the recommended way, to simply add a jar upon my application depends of?
Any help would be apreceated,
Yuval.
HI Yuval,
To include any Jar file in App server class path, you only have to copy the file in J2EE home\Lib\ folder. I also tried passing classpath to OC4J bUt to no use.
But its working fine.
Amit
Similar Messages
-
Classes in added jar on classpath not found
Hi there,
The javafx compiler seems to have trouble finding classes from a jar that was added to the lib directory of a javafx project. I experience this trouble when working with the Netbeans 6.5.1 IDE and javafx version 1.2.
When trying to import a single class in a javafx file from a manually added jar, a compiler error occurs stating that the class cannot be found. Package names, however, do get recognized when importing classes, and therefore star import are possible. The actual classes from a package that was imported by means of a star import, don't get recognized.
Does anyone have an idea what causes this problem and how to resolve it?
Kind regards and thanks in advance,
RienkCan I refer classes in embedded jar's? I thought that did not work. It wasn't working so I tried putting the same jars into the same directory as the main class.
Let me try again with less information.
My jar with the main class is: testpojo.jar
The class path inside the manifest is
Class-Path: swing-layout-1.0.03.jar AbsoluteLayout.jar
The directory with the external jar is:
Directory of C:\DOCUME~1\MDARR\WORKSP~1\TESTPO~1\TARGET
9/11/2008 10:44 PM <DIR> .
9/11/2008 10:44 PM <DIR> ..
9/11/2008 10:44 PM 2,850 AbsoluteLayout.jar
9/11/2008 10:44 PM 118,103 swing-layout-1.0.3.jar
9/11/2008 10:56 PM 51,660 testpojo.jar
Unless I've missed something the the swing-layout-1.0.3.jar jar file is in the same relative directory as testpojo.jar.
When I execute the main class should be able to reference classes in that file.
But it gets,
Exception in thread "main" java.lang.NoClassDefFoundError: org/jdesktop/layout/GroupLayout$Group
What's happening? It's a little confusing because the same jar is also stored inside testpojo.jar. I read that Java can't load from embedded jar's so I tried putting them in the same directory as testpojo.jar and setting the class path inside the manifest.
And yes, I understand about the main class name. That was just me goofing around trying to label things. At this I'm a rookie.
Tia,
Maurice -
[ImageIO] add plugin jar to classpath
Hello Experts,
I have built a WebDynpro application in which I need to resize images (JPG, PNG and GIF). I use standard library :
boolean writeResult = ImageIO.write(bufferedImg, fileExtension, streamOut);
This works fine, except for the GIF format for which there is no standard writer.
I decided to use <a href="https://gif-plugin.dev.java.net/">gif-plugin</a> which should do the trick.
According to the plugin documentation : "<i>Just copy the plugin jar to somewhere in the classpath.
The jdk should automatically detect the plugin</i>".
I added the jar in an external library, exactly the same I do for other external jars I use.
I can see the jar in the classpath when opening 'Project > properties > Java Build Path > Libraries"
But seems that it is not been added to the classpath at runtime because plugin is not detected.
Do you have any hint on that ?
Thanks a lot.
Regards,
NicolasIn your external library DC you should create public part with type assembly - and add neccessary libs to in. Build it.
IN Webdynpro DC you should add reference on created pp with type 'build'. Build WD DC - now Wd ear file should contain required custom jar and will be able to use it on runtime. -
Revision: 18377
Revision: 18377
Author: [email protected]
Date: 2010-10-29 12:17:57 -0700 (Fri, 29 Oct 2010)
Log Message:
Remove WEB-INF/flex/jars from classpath in qa-manual and qa-regress. This folder no longer exists as we don't have the webtier compiler.
checkintests: passed
Modified Paths:
blazeds/trunk/qa/apps/qa-manual/build.xml
blazeds/trunk/qa/apps/qa-regress/build.xml -
Hi, Portal guru:
I installed wls9.2&portal9.2, and put p13n_app.jar and p13n_system.jar into classpath from startWeblogic.cmd.
then looks portalApp can not be loaded due to the following exception:
java.lang.Error: Clonable is not clonable: java.lang.CloneNotSupportedException: com.bea.p13n.expression.operator.c
omparative.Equals: 4138928
com.bea.content.expression.PropertyRef: 4138900
java.lang.String
cm_nodeName
java.lang.String
CmxControlUniqueKeysFolder
: com.bea.content.expression.PropertyRef
at com.bea.content.expression.Search.clone(Search.java:568)
at com.bea.content.manager.internal.SearchOpsImpl.createSearchForRepo(SearchOpsImpl.java:376)
at com.bea.content.manager.internal.SearchOpsImpl.searchRepository(SearchOpsImpl.java:203)
at com.bea.content.manager.internal.SearchOpsImpl.search(SearchOpsImpl.java:159)
any know what is the problem?
Thanks in advance.I don't think it's supported to have app-scoped class in the system
classpath. I'm surprised your 814 app worked that way.
It might be that changes in 9.2 have caused some of the classes the
system classloader is hitting to now try to load other classes that are
only available in an application classloader, which the system
classloader cannot access.
http://e-docs.bea.com/wls/docs90/programming/classloading.html has
information about the classloader hierarchy in WLS/WLP.
One way to have a system-classloader class access an
appliation-classloader is via the
Thread.currentThread().getContextClassLoader(), and then either use
reflection or have the class implement an interface available in the
system classloader. This allows code at the system classpath level to
access implementation classes loaded up as part of an application,
rather than relying upon the built-in classloading which can't see
classes in children classloaders. However, this would entail having a
system classpath jar and an application jar, which is why WLP has
p13n_system.jar and p13n_app.jar.
Greg -
Bug:WEB-INF/lib JARs not added to runtime classpath of WebLogic Server
The JAR files packaged in the WEB-INF/lib directory of an application do not get installed to the runtime classpath of the Weblogic server.
Edited by: dvohra16 on Feb 28, 2013 9:24 AMSome posts in which an external jar, usually a JDBC jar, had to be added to the startWebLogic script to be added to the runtime classpath of WebLogic server.
Re: jdbc problem on MS SQL Server
Re: MySQL JDBC driver w/11.1.2 where too now?
Re: ADF Parameter form - java.lang.NoClassDefFoundError: sqlj/runtime/ref/Defa
Re: Cannot load driver class: com.microsoft.sqlserver.jdbc.SQLServerDriver
Re: deploy a shared library
Re: Cannot load driver class: com.microsoft.sqlserver.jdbc.SQLServerDriver
Re: Help need in Adding External jar files.
Re: NoClassDefFoundError while Testing a JAX-WS Web Service
Re: Unable to connect to SQL server 2008 from a deployed Weblogic application
Re: Howo to add external jar - quick question
Re: MySql connection with JDev 11.1.2.2 issues
Re: Integration of MySQL with ADF application -
Adding jars to commerce server classpath
I have an installation of WebLogic Commerce Server 3.5, and I'm trying
to adapt an existing Web application so that it runs as a portlet. The
JSPs in the application use classes that reside in a JAR file. How does
one add this JAR file to the classpath of the JSP compiler used by the WLCS?
--RafeThis group is for WLS installs. Please post your request to
weblogic.developer.interest.commerce.
Thanks,
Bill Kemp
BEA Systems
Rafe Colburn wrote:
I have an installation of WebLogic Commerce Server 3.5, and I'm trying
to adapt an existing Web application so that it runs as a portlet. The
JSPs in the application use classes that reside in a JAR file. How does
one add this JAR file to the classpath of the JSP compiler used by the WLCS?
--Rafe -
Dynamically adding jars to the classpath at runtime
Hi All,
I have a query regarding dynamically loading jars at runtime. I am developing an application that uses third party jars and there are a number of different versions that the utility is to support so I want to be able to load the jars relating to that specific version through selection on the gui. The jar files are the same name for all versions e.g.
v1 has app1.jar
and v2 has app2.jar
I have these in separate folders called app1jars and app2jars. I have tried a number of classloader examples but always get a classnotfoundException. Any ideas? Thanks in advance for repliesHi,
Sorry for being a bit vague. I have attached the code below that I was trying. Im confused about how to load the classes within each of the jars and use them do i have to use defineclass? AppSession is an interface.
import java.util.*;
import java.net.*;
import java.sql.*;
import com.app.AppSession;
import com.app.AppWorker;
import java.io.*;
import java.lang.reflect.Method;
public class JarTest {
public static File[] getExternalJars()
{ String jarDirectory = "C:\\JarLoaderTest\\1.1jars";
File jardir = new File(jarDirectory);
File[] jarFiles = jardir.listFiles();
return jarFiles;
public static void main(String[] args) throws Exception {
Method addURL = URLClassLoader.class.getDeclaredMethod("addURL", new Class[] {URL.class});
addURL.setAccessible(true);
File[] files = getExternalJars();
ClassLoader cl = ClassLoader.getSystemClassLoader();
for (int i = 0; i < files.length; i++) {
URL url = files.toURL();
System.out.println(url.toString());
addURL.invoke(cl, new Object[] { url });
cl.loadClass("AppSession").newInstance();
cl.loadClass("AppWorker").newInstance();
try
{ AppSession session = AppWorker.getConnection(username,password,port,server); // these are filled in with the actual details in my program
catch(Exception e) -
Adding jar file in my gerareted jar file using netbean 4.0
Hi,
I write an application de process XML file using JDOM. I add the JDom package jar file to my project and everything work fine. But when I generate, my project jar file using netbean 4.0, my generated jar, is not working with the XML files anymore. Everything seems like it didn't include the JDOM jar file?
Thanks for any help to fix the problem.I find that you can not use command-line such as java -classpath add classpath
it can not work, I use netBeans4.0 i don't whether because of netbeans or java itself.
you can add classpath in jar's Manifest.mf file
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.6.2
Created-By: 1.5.0_01-b08 (Sun Microsystems Inc.)
Main-Class: chat.Main
// add this line
Class-Path: dir\*.jar //(jar file name)
X-COMMENT: Main-Class will be added automatically by build -
Putting Jar in ClassPath/Loading JDBC Driver on Linux
Hi,
I have got this to work on Windows � but then I simply put the Connector-J Jar into the �lib� directory of my Java installation. On this Linux machine I do not have the privileges to the �lib� directory � so I need to add the Jar to the class path � but it is not seeming to get added.
I would appreciate any suggestions. I have copied the Connector-J Jar file to the Current working directory and I have tried
java -classpath './mysql-connector-java-5.1.6-bin.jar' -Xmx512M -jar ProcessBigDump_fat.jar
java -cp mysql-connector-java-5.1.6-bin.jar -Xmx512M -jar ProcessBigDump_fat.jar
Thank you for any ideas.
O.O.When you use "-jar" any user settings of the classpath are ignored. Everything has to be specified within the jar archive itself.
Jars have a "manifest" which lets you do this. ProcessBigDump_fat.jar will already have a manifest: it has to in order to specify the main class. There will be a line like:
Main-Class: myapp.Main(Assuming the class with the static main() method was Main and it was part of the myapp package.)
What you have to do is add another line something like:
Class-Path: mysql-connector-java-5.1.6-bin.jarwhich will use the mysql jar (located in the same place as your jar) as part of the classpath.
Details in Sun's Tutorial. -
i have this directory structure:
deploy/
deploy/program/
deploy/program/(classes)
deploy/program/subfolder/
deploy/program/subfolder/(classes)
from deploy i am jarring with the command:
jar cfm Program.jar manifest.txt Program
with the following manifest text:
Main-Class: Program
Class-Path: Program/ Program/subfolder/
(new line with no space)
my main class is called "Program"
the classes in "Program" and "subfolder" are NOT in a package (they are "loose" classes)
ive tried MANY different entries for the manifest classpath but get the same result:
Exception in thread "main" java.lang.NoClassDefFoundError: Program
please help!there are no packages because this is just a hack up demo with 15 or so classes.
i thought itd be easy enough to jar this without adding packages. : /
i could just throw them in one folder but this has become a battle of pride, lol.
DrClap if I jar from the Program folder instead of Deploy with:
jar cfm Program.jar manifest.txt *.class subdirectory
and manifest:
Main-Class: Program
Class-Path: subdirectory/
I get:
Exception in thread "main" java.lang.NoClassDefFoundError: (subdirectory class)
If I delete the Class-Path entry altogether I get the same Exception. -
External Jars in Classpath are removed by DC build. Please Help
Hi All,
I have a problem with my classpath. Everytime I try to build a DC some parts of my classpath are emptied. Most notably the external JAR: com.sap.security.api.jar.
It makes it it impossible to do a DC build and use the components in other DCs.
I already tried to add it as a variable like this:
Name: SAP_SECURITY_LIB_HOME
Path: C:/Program Files/SAP/JDT/eclipse/plugins/com.sap.security/lib/com.sap.security.api.jar
It didn't help either.
This problem makes it impossible for me to work with DCs. What am I doing wrong?
Thanks in advance,
JeschaelHi Jeschael,
Instead of adding the "com.sap.security.api.jar" by going to the properties, add the same as Used DC.
1) Go to DC Meta Data
2) Right Click on the Used DCs
3) Select Add Used Dcs
4) Go to the SAP-JEE compartment under Local Development
5) Select the DC "com.sap.security.api.sda"->Finish.
If you add library in this way your problem will be resolved.
Regards,
Jhansi -
Javac with a Jar and classpath
I am trying to figure out how do I make Javac see the thinlet.class in the thinlet.jar.
I have developed an XUL xml interface and a java program that calls the interface shown below:
//package thinlet.demo;
import thinlet.*;
public class UI extends Thinlet
{ public UI () throws Exception {add(parse("UI.xml"));}
public static void main(String[] args) throws Exception
{ new FrameLauncher("UI", new UI(), 600, 600); }}
when I do the normal compile, I get an error:
UI.java:4: cannot find symbol
symbol: class Thinlet
public class UI extends Thinlet {
^
UI.java:7: cannot find symbol
symbol : method parse(java.lang.String)
location: class thinlet.demo.UI
add(parse("UI.xml"));
^
UI.java:12: cannot find symbol
symbol : class FrameLauncher
location: class thinlet.demo.UI
new FrameLauncher("UI", new UI(), 600, 600);
^
3 errors
This thinlet class should be in the thinlet.jar that I have added the directory to the path, the directory and jarfile name to the System CLASSPATH and it couldn't see it. So finally I tried putting the thinlet.jar in the same directory to no avail. I've searched the web for some time an cannot find anything that specifically speaks to compiling a program that has parent classes in a Jar.
Any help is definitely appreciated.What's with the commenting out of the package statement?
Where are things located?
Read this before posting anything more:
[How Classes are Found|http://java.sun.com/javase/6/docs/technotes/tools/findingclasses.html] -
Jar Files in a Jar File - Classpath Error
Hi,
I created a jar file that will have all the class files of the application. In the manifest file class path, I have the jar files the application is dependent on. The dependent jar files were kept outside of the application jar file. I was able to execute the main file in the application jar file. Then I created another jar file that holds all the dependent jar files the application is dependent on along with the application jar file into one super jar file. configured the main class attribute of the super jar file to that in the application jar file. When I try to execute it, I'm getting an error saying Class Not Found. Can someone guide me in setting the classpath for this super jar file in its manifest file.
Presently my manifest file classpath variable in the super jar file is set as App.jar Depend1.jar Depend2.jar
Thanks,
E HJava's standard class loaders do not support jar files inside of other jar files, and will give the error you see.
You can write your own customized class loader, use a 3rd-party solution (onejar at sourceforge is one), or remove the interior jars. -
Hi All
How can i add jar to my project environment.
Actually what i did was.
Created one folder called "JavaWork" like d:\JavaWork
and put the jar file into this folder and wrote a test class which is importing some classes from the jar file.
how to use jar ? Please someone help me.
Thanks in advance
Shan`man jar`
jar(1) jar(1)
NAME
jar - Java archive tool
SYNOPSIS
jar [ -C ] [ c ] [ f ] [ i ] [ M ] [ m ] [ O ] [ t ] [ u ]
[ v ]
[ x file ] [ manifest-file ] destination input-file
[ input-files ]
DESCRIPTION
The jar tool is a Java application that combines multiple
files into a single JAR archive file. It is also a gen-
eral-purpose archiving and compression tool, based on ZIP
and the ZLIB compression format. However, jar was
designed mainly to facilitate the packaging of Java
applets or applications into a single archive. When the
components of an applet or application (.class files,
images and sounds) are combined into a single archive,
they can be downloaded by a Java agent (like a browser) in
a single HTTP transaction, rather than require a new con-
nection for each piece. This dramatically improves down-
load time. The jar tool also compresses files, which fur-
ther improves download time. In addition, it allows indi-
vidual entries in a file to be signed by the applet author
so that their origins can be authenticated. The syntax
for the jar tool is almost identical to the syntax for the
tar(1) command. A jar archive can be used as a class path
entry, whether or not it is compressed.
The three types of input files for the jar tool are:
o Manifest file (optional)
o Destination jar file
o Files to be archived
Typical usage is:
example% jar cf myjarfile *.class
In this example, all the class files in the current direc-
tory are placed in the file named myjarfile. A manifest
file is automatically generated by the jar tool and is
always the first entry in the jar file. By default, it is
named META-INF/MANIFEST.MF. The manifest file is the
place where any meta-information about the archive is
stored. Refer to the Manifest Format in the SEE ALSO sec-
tion for details about how meta-information is stored in
the manifest file.
To use a pre-existing manifest file to create a new jar
archive, specify the old manifest file with the m option:
example% jar cmf myManifestFile myJarFile *.class
When you specify cfm instead of cmf (that is, you invert
the order of the m and f options), you need to specify the
name of the jar archive first, followed by the name of the
manifest file:
example% jar cfm myJarFile myManifestFile *.class
The manifest uses RFC822 ASCII format, so it is easy to
view and process manifest-file contents.
OPTIONS
The following options are supported:
-C Changes directories during execution of the jar com-
mand. For example:
example% jar uf foo.jar -C classes *
c Creates a new or empty archive on the standard out-
put.
f The second argument specifies a jar file to process.
In the case of creation, this refers to the name of
the jar file to be created (instead of on stdout).
For table or xtract, the second argument identifies
the jar file to be listed or extracted.
i Generates index information for the specified jar
file and its dependent jar files. For example,
example% jar i foo.jar
would generate an INDEX.LIST file in foo.jar which con-
tains location information for each package in foo.jar and
all the jar files specified in foo.jar's Class-Path
attribute.
M Does not create a manifest file for the entries.
m Includes manifest information from specified pre-
existing manifest file. Example use:
example% jar cmf myManifestFile myJarFile *.class
You can add special-purpose name-value attribute
headers to the manifest file that are not contained
in the default manifest. Examples of such headers
are those for vendor information, version informa-
tion, package sealing, and headers to make JAR-bun-
dled applications executable. See the JAR Files
trail in the Java Tutorial and the JRE Notes for
Developers web page for examples of using the m
option.
O Stores only, without using ZIP compression.
t Lists the table of contents from standard output.
u Updates an existing JAR file by adding files or
changing the manifest. For example:
example% jar uf foo.jar foo.class
adds the file foo.class to the existing JAR file
foo.jar, and
example% jar umf foo.jar
updates foo.jar's manifest with the information in
manifest.
v Generates verbose output on stderr.
x file
Extracts all files, or just the named files, from
standard input. If file is omitted, then all files
are extracted; otherwise, only the specified file or
files are extracted.
If any of the files is a directory, then that direc-
tory is processed recursively.
EXAMPLES
To add all of the files in a particular directory to an
archive:
example% ls
0.au 3.au 6.au 9.au at_work.gif
1.au 4.au 7.au Animator.class monkey.jpg
e.au 5.au 8.au Wave.class spacemusic.au
example% jar cvf bundle.jar *
adding: 0.au
adding: 1.au
adding: 2.au
adding: 3.au
adding: 4.au
adding: 5.au
adding: 6.au
adding: 7.au
adding: 8.au
adding: 9.au
adding: Animator.class
adding: Wave.class
adding: at_work.gif
adding: monkey.jpg
adding: spacemusic.au
example%
If you already have subdirectories for images, audio
files, and classes that already exist in an HTML direc-
tory, use jar to archive each directory to a single jar
file:
example% ls
audio classes images
example% jar cvf bundle.jar audio classes images
adding: audio/1.au
adding: audio/2.au
adding: audio/3.au
adding: audio/spacemusic.au
adding: classes/Animator.class
adding: classes/Wave.class
adding: images/monkey.jpg
adding: images/at_work.gif
example% ls -l
total 142
drwxr-xr-x 2 brown green 512 Aug 1 22:33 audio
-rw-r--r-- 1 brown green 68677 Aug 1 22:36 bundle.jar
drwxr-xr-x 2 brown green 512 Aug 1 22:26 classes
drwxr-xr-x 2 brown green 512 Aug 1 22:25 images
example%
To see the entry names in the jar file using the jar tool
and the t option:
example% ls
audio bundle.jar classes images
example% jar tf bundle.jar
META-INF/MANIFEST.MF
audio/1.au
audio/2.au
audio/3.au
audio/spacemusic.au
classes/Animator.class
classes/Wave.class
images/monkey.jpg
images/at_work.gif
example%
To display more information about the files in the
archive, such as their size and last modified date, use
the v option:
example% jar tvf bundle.jar
145 Thu Aug 01 22:27:00 PDT 1996 META-INF/MANIFEST.MF
946 Thu Aug 01 22:24:22 PDT 1996 audio/1.au
1039 Thu Aug 01 22:24:22 PDT 1996 audio/2.au
993 Thu Aug 01 22:24:22 PDT 1996 audio/3.au
48072 Thu Aug 01 22:24:23 PDT 1996 audio/spacemusic.au
16711 Thu Aug 01 22:25:50 PDT 1996 classes/Animator.class
3368 Thu Aug 01 22:26:02 PDT 1996 classes/Wave.class
12809 Thu Aug 01 22:24:48 PDT 1996 images/monkey.jpg
527 Thu Aug 01 22:25:20 PDT 1996 images/at_work.gif
example%
If you bundled a stock trade application (applet) into the
following jar files,
main.jar buy.jar sell.jar other.jar
and you specified the Class-Path attribute in main.jar's
manifest as
Class-Path: buy.jar sell.jar other.jar
then you can use the i option to speed up your applica-
tion's class loading time:
example$ jar i main.jar
An INDEX.LIST file is inserted in the META-INF directory
which will enable the application class loader to download
the right jar files when it is searching for classes or
resources.
SEE ALSO
keytool(1)
JAR Files @
http://java.sun.com/docs/books/tutorial/jar/
JRE Notes @
http://java.sun.com/j2se/1.3/runtime.html#exam-
ple
JAR Guide @
http://java.sun.com/j2se/1.3/docs/guide/jar/index.html
For information on related topics, use the search link @
http://java.sun.com/
13 June 2000 jar(1)
Maybe you are looking for
-
OTV Mandatory Fields - Bank Data
Hi there, We would like to set Bank data as a mandatory field, when posting an invoice to a One Time Vendor, but cannot see how to make this mandatory. We can see where the Name and City are coded to be mandatory in FFCPDI (CPD_DATEN_PRUEFEN), but a
-
Migration manager on Imac doesnt recognize the second HD partition on old G4. Any advice? Thanks! G
-
The same error appear the account is not in the correct state, when I'm trying to create a new service (remote app collection, upload template,..). any ideas.
-
Can't open pages documents after time machine restore.
Hi, I had to do a restore of my document folder from time machine and now I can't open any pages documents. It just says not a valid format. It is only the pages documents that are affected. Not word documents. If I try to convert to plain text (or a
-
Unable to access following end point(s)
Hi All, I am facing very strange thing in my BPEL. Third party is sending message to my SOA BPEL process.Starting point of the (input variable place) is not showing the message for some inputs from third party.For some input messages of third party,