Using .jar files in WebDynpro DC's
Hello,
I am having a problem while trying to create a structure for a Web Dynpro component using .jars.
For a better understanding of the background, the whole story happens in JDI SS9 (SAP NW Dev Studio 2.0.9 and it's corresponding DTR version) therefore the External Library DC is not available to me.
That being said, here goes the problem description.
We would like to create a WebDynpro DC (DC1) which would contain a WebDynpro component WDA using a WebDynpro component WDB which has been developed as part of another DC DC2.
Now, of course that a typical DC structure (have both components inside DTR, create the appropriate dependencies between them, so on, so forth, will work). But there is another thing we would like to do, namely use the .jar created as a public part for WDB in DC2 directly.
So, we include the named .jar as an external library in the project structure of WDB.
Let aside runtime issues, which are going to be solved by using sharing references, DC1 won't compile - moreover, because WDB cannot be used as a 'Used WD component' from within WDA because it's not available at all. As if the .jar is not seen.
But if we would create a simple project, not a DC, the .jar is perfectly usable that way. The WebDynpro project compiles fine, and WDB appears as a referenceable component.
So, in short, the question is: what can we do to get a workable DC structure based merely on the .jar public parts and not on the whole DC tree ? A good example here would be the ability to create a Local DC using .jar public parts of DC's located in DTR.
I repeat, the problem must be solved in the SS9 context. I am aware of the existence of External Libraries in later versions, but currently I find myself confined to this one.
Thanks,
Marius
Hi Marius,
check the following web blog,
/people/valery.silaev/blog/2005/09/14/a-bit-of-impractical-scripting-for-web-dynpro
thanks and regards
Brahmanandam Ausali
Similar Messages
-
How to call the methods of JAR file into webDynpro Environment
Hi All ,
I have a requirement to call the methods of a JAR file into
WebDynpro Environment. can anybody suggest me How this can be achieved. I Have a JAR file named FastTrack.API
which contains few methods and i want these methods to be accessable into WebDynpro as other methods.
Plz Somebody help me to sort this out.
Regards,
Deepak.Deepak,
Please follow these 2 steps:
1. Add jar into webdynpro project
Right Click on ur project -> Select properties -> Java Buil path -> Choose Libraries Tab -> Add External Jars -> add the file from ur computer
2. Use the jar
write the import statement in your webdynpro code to utilize the properties of added jar.
Thanks & Regards,
Ram -
Adding External jar file in webdynpro in CE 7.1 EHP 1
Hi,
How to add external jar file in webdynpro component. I am using CE 7.1 EHP 1 SP04 .Public part of external library is used in the webdynpro dc. I created Enterprise Application and used that in runtime in the wybdynpro dc also.
I am not getting any error at the time of deploy but at the time of activating getting the following error.
ERROR: E:\usr\sap\CED\J10\j2ee\cluster\server0\temp\CBS\1\.B\354\t\65FFED04CAA1231EE16A570686EC24D6\gen_wdp\packages\com\sap\home\ovsuser\ovsuserapp\comp\OvsUserComp.java:23: package com.sap.security.api does not exist
[javac] ERROR: import com.sap.security.api.ISearchAttribute;
[javac] ERROR: ^
[javac] ERROR: E:\usr\sap\CED\J10\j2ee\cluster\server0\temp\CBS\1\.B\354\t\65FFED04CAA1231EE16A570686EC24D6\gen_wdp\packages\com\sap\home\ovsuser\ovsuserapp\comp\OvsUserComp.java:24: package com.sap.security.api does not exist
[javac] ERROR: import com.sap.security.api.ISearchResult;
Please help.
RaktimHello Raktim
com.sap.security.api should be available within NWDS plugins and should work fine if you add sap-jee DC as used dc.
For external jars check this link
[http://wiki.sdn.sap.com/wiki/display/Java/Externaljarfileerrorand+Solution]
works fine in netwever 7.01 .
Regards -
Error while using .jar file instead of class file.
Hello friends,
I created a java class which are referred and called from other jsp\xml and java files. I compiled this java class and everything is working properly. However, I do not want to use class files but want to use jar files instead. So, I created a jar file of this class file by using the command "jar -cvf jarfilename.jar".I kept the jar file in its respective folder .Also, I removed the class file from its path, just to see that the jar file will work automatically.
Unfortunately, I am getting an error:
java.lang.RuntimeException: Component.createComponent(...) Component class not found: <java class path>. I also tried giving the path of this jar file in the classpath. This also does not seem working.
How to solve this problem?
Thanks,
Ranjith M.V
Edited by: RanjithM.V on May 11, 2008 10:34 PMYou probably populated the jar file incorrectly.
A common mistake is to include the path that you had on the classpath, in the jar file.
So a person will have a classpath like this: /foo/
And a class in a package bar, like this:
package bar;So that other classes would include the file like this:
import bar.TheClass;And the class file is on the filesystem like this:
.../foo/bar/TheClass.classThen they'll create the jar file including the foo directory, so if they list the jar's contents, they'll see the above (/foo/bar/TheClass.class). But this is wrong. It should start off so that the jar entries start with the top-level package names (like /bar/TheClass.class).
Maybe you've done that. -
Help using jar file!
Hello
I have created a jar file by using
jar cvmf Manifest.txt myjar.jar 1.class Mydirectory
In 1.java file :I have used
JEditorPane editor;
editor.setPage(getClass().getResource("/Mydirectory/default.htm"));
If I am only giving myjar.jar file to the client without Mydirectory then also it is working fine by showing default.htm in JeditorPane.
But my problem is I want to use
Runtime.getRuntime().exec("cmd /c start IEXPLORE"+targetstr) ;
targetstr will be the filename with path of the default.htm
If I am giving myjar.jar file with Mydirectory to the client it is working but I don't want to give Mydirectory to the client .
What should I do?
Is there any solution for this?
Using another jar file which will include mydirectory can solve this problem?
Is there any othe concept in java so that I wll be able to hide Mydirectory from client?
Please help.It seems like you could extract the .htm file from the jar, either with Runtime.exec or using the Jar API classes.
-
I was able to use .jar files in Java programs that I write on my computer. I could write a program that used an import statement to bring in classes contained in a .jar file.
One day, I was trying to incorporate a jar file folder directly into my windows operating system by using the environmental variable called CLASSPATH. Unfortunately, I made the mistake of screwing up my PATH variable. I fixed my PATH variable back up by adding the directory to the bin folder inside of the Java folder as is described commonly by the documentation for installing the Java SE on windows computer.
Since that day, I have not been able to use .jar files using an import statement. My computer is unable to find the .jar files even if I specify the exact directory. Even the IDE(netbeans) that I use is unable to find and use .jar files. I have found that I can open up .jar files and pull the contents that I need out of said .jar files, but I have a project that does not allow me to open up the .jar files and extract the needed classes.
I have googled this problem so much that I have read hundreds of posts about .jar files, and I cant find anyone in a situation that is similar to mine. If I take my files to another computer with Java SE installed, then my source code can access the .jar files just fine. For some reason, my work computer seems to hate using .jar files. I have no idea what could be the problem. There is no information in the java documentation on troubleshooting with this problem, and the most confusing part is that it worked perfectly fine until That one day
Does anyone have any ideas?
Specific technical details:
I need to pull the Stopwatch.class file from a stdlib.jar file. In the past I had done this by using an import statement inside of my program:
"import stdlib.Stopwatch; "
Using this command to compile:
"javac -cp .;(directory path to .jar file); source.java"
This used to work. Now when using the javac command I get error messages
1. Error points directly to import statement. Arrow directed at the period after stdlib.
"cannot find symbol"
2. Error message pointing to all instances of the class that I was attempting to import into my program.
Thanks for reading
Edited by: 955611 on Aug 28, 2012 7:22 PMI read your post. I want to compile this project by using the "-classpath" option in the javac command. After screwing up important system variables once, I do not want to continually have to play with system variable in order to compile projects. To quote from the website that you linked:
Using the JDK tools' -classpath option
The JDK tools java, jdb, javac, and javah have a -classpath option which replaces the path or paths specified by the CLASSPATH environment variable while the tool runs. This is the recommended option for changing class path settings, because each application can have the class path it needs without interfering with any other application.
The runtime tool java has a -cp option, as well. This option is an abbreviation for -classpath.
For very special cases, both java and javac have options that let you change the path they use to find their own class libraries. The vast majority of users will never to need to use those options, however.
Clearly, the "-classpath" option in the javac is intended to replace the need to play with important system variables. I guess my post boils down to the question of "Why doesn't this command work for me?". I followed your suggestion by removing the bin directories and adding the stdlib.jar directory directly into the system variable itself. Here is the following output from my command prompt:
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
C:\Documents and Settings\Lelo>E:
E:\>cd Programs\Java
E:\Programs\Java>javac testy.java
testy.java:1: error: package stdlib does not exist
import stdlib.Stopwatch;
^
1 error
E:\Programs\Java>echo %CLASSPATH%
C:\Program Files\Java\jre6\lib\ext\QTJava.zip;E:\Programs\Java\stdlib.jar;
E:\Programs\Java>javac -classpath .;E:\Programs\Java\stdlib.jar; testy.java
testy.java:1: error: package stdlib does not exist
import stdlib.Stopwatch;
^
1 error
E:\Programs\Java>
I still received the same errors. It seems that even adding the directories into the system variable will not work for me. -
Using JAR file in running application and POI !
Hi all
I am trying to use POI HSSF f(for the first time, So pls bear with me!)or creating excel file from my java Application. I am using the jar file :
poi-2.0-RC2-20040102.jar. Not sure if its the correct one. So If I am wrong pls correct me.
Now I am creating a bat file to compile my application:
@echo off
C:\jdk1.3.1_04\bin\javac -classpath C:\POI\poi-2.0-RC2-20040102.jar MyApp.java
pauseIt compiles fine. Now If I try to use the jar file in run.bat for running my application, it says NoClassDef FoundError:MyApp. Here is my run.bat
java -classpath C:\POI\poi-2.0-RC2-20040102.jar MyApp
pauseI am not able to run my application with this run.bat file . If I change the content to:
"java MyApp.java"
It runs but give me error: NOClassDefFoundError:import org.apache.poi.hssf.usermodel.HSSFWorkbook
Pls suggest me about how to use jar file in running my app and how to rresolve workbook finding problem.
ReagrdsTry this:
java -classpath .;C:\POI\poi-2.0-RC2-20040102.jar MyApp
pauseNote the "dot semi-colon" at the start of the CLASSPATH. That puts the current directory in the CLASSPATH, which is where MyApp.class lives. (No package, right?)
See if that works better. -
Performance issue if we use jar file instead of classes
Hi,
My application uses tomcat as web server.
If i use calsses in webapps -> WEB-INF -> classes folder, i place classes in that ,
In other case i use jar file and place that file in WEB-INF -> lib folder in the webapps directory.
There is huge performance difference.
While using classes performance is great while using jar file performance is very disappointed.
I am using a file for encryption /decryption also.I can't really believe that classes vs jars makes a difference, but whatever.
-
How to use jar files without setting classpath
Hi,
I have a situvation, I can not set classpath, but i have to use jar files, how can I do that.URL[] urls = new URL[]{pathToJar, pathToAnotherJar, ...};
URLClassLoader urlc = new URLClassLoader(urls);
Now load classes within the jars loaded by the urlc classloader as needed. This is a limited approach, you can mostly use interfaces to work with classes loaded by the custom loader instance above and your existing classes. -
dear guys,
can somebody tell me why would use jar file? how it would be use? i would like to get the idea of jar file
thanksAre you familiar with zip files? A jar file is just a kind of zip (the jar utility will even read zip files as though they were jars).
The most common use is to hold .class files generated from all the classes of a Java program so that you can run the program from that one file, rather than very large numbers of small class files. Libraries of classes are almost always stored as jars.
Of course you can put other stuff in there too, like image files and the like. -
Use jar file for one servlet in one application (not global in classpath)
I have a servlet application that needs a jar file to load with one particular servlet. If I put the classpath to the jar file in the jvm12.conf, the servlet loads fine. I can't run it like that, however, since I use another jar file by the same name in a different application. I would like to specify it only with the servlet that needs it. According to the online help file, it says more than one jar, zip, or class file can be specified in the servlet classpath, but that doesn't seem to be the case. We're running iPlanet 4.1. I've tried adding the classpath to the jar file after the classpath for the servlet itself (servlet.properties), but it gives the class not found error for that function. Is there a way to do this? Context.properties, maybe? I can't find any instructions on setting that up.
You might have better luck asking this question on a web server forum. This is an application server forum and most people here are going to more experienced with iAS.
David -
How to add one poi jar file into webdynpro project
Hi all:
We would like to add one poi jar file into one webdynpro project, however, what should we do ?
Its one external 3rd party jar file.Hi,
To add a jar file you need to have an external library DC.
Hope the below link will help you:
[http://help.sap.com/saphelp_nw70/helpdata/en/46/3ce3e4df201d63e10000000a11466f/frameset.htm]
thanks & regards,
Manoj -
can the jar file being used in a pc that not installed with jdk?what i need to do to make the jar file to work in a pc that not installed with jdk?
if so, that means that i have to provide the JRE file
and my jar file at the same time to the pc i wanted to
use the jar?
Only if the pc does not already have a java runtime.
Similarly, if the pc does not have a web browser you couldn't use web sites on that pc.
if there any other way that i can just use
the jar file without the JRE?
No.
or do i need to make it
into a exe file rather than a jar file then the
problem will be solved?
I'd not recommend that, but the question of making native executables comes up every week so I suggest using the search features on this site. -
We are having a discussion at work about the proper usage of jar files. I am fairly opinionated and need to get some good feedback on when jar files make sense.
Network:
We have a unix based network as well as a windows based network. We can share samba mounted drives and allow windows access to the class files on the unix network. Most of our internal webservers are on the unix platform.
We use java in applications, servlets, and JSP's. We have also designed an electronic technical manual that will be deployed via internet and cd rom.
My first contention that jar files are not needed in the Servlet environment. The class files are virtually local and file storage is not an issue.
My second contention is that applications running on windows machines would have better performance from local jar files, but the benefits are outweighed by the need to rebuild and reinstall the jar files to ensure the applications behaved the same on both systems.
My third contention is that the technical manual on cd is a very good candidate for use of jars. We have a limited amount of space to store the files on a cd. We would probably use the jars to serve the information to ensure the behavior of the manual is the same whether the application was access via the CD or the internet.
What am I missing? Is my understanding of JAR files out of whack with reality?Jar files (and their siblings i.e. Wars, Ears) make a
good unit of deployment. It is much easier to keep
track of a few jars than a bunch or classes.We have classes which are used in several applications. Ie, A bean queries our bill of material. It is used in an engineering, a manufacturing and a planning application. It can also be used in a jsp. If that bean changes, we would have to deploy three new jar files. If we run from one directory structure, a simple compile fixes all three applications.
With the samba mounts, we can get to the directory from windows and most flavors of unix.
We actually have two directory structures. One for production and one for test. Developers usually have another copy stashed somewhere for development purposes.
I don't know where you get better performance. The
jar needs to be unzipped which can only slow
performance. Rebuilding a jar is easy (get Ant) and
reinstalling a jar is easier than installing a buch of
class files and resources (see above.) In addition,
you can seal jars which gives you some level of
protection (though superficial) and you can set up the
jar so that it knows the main class.For the most part, these are internal applications, so security is not the top priority. Jars would be nice as they should generate less network traffic due to their smaller size.
A jar is really just a zip file with a special
structure. This is really a question of whether you
need compression. If you can't fit everything onto a
single CD then compression can help. A plain old zip
file would work just as well.The compression is the main reason for the techpub application using the jar files. Space on the CD is a concern. Also, for internet access, bandwidth is also a concern. IE, less bits to shove down the wire.
Like I said before jars are a convienient way to keep
things organized. You can send out a program in a
single unit that has everything it needs to run.I have an aversion to anything which requires an install on the users box. This probably comes from working with a bunch of unix hacks that have our system tuned to the nth degree. Much easier to deploy to one central location. No worries about whether or not someone turned their machine off before the nightly push, who has admin rights, etc. Map to the drive and you are off and running. One big performance hit is running the jvm from a shared drive. The JVM should be installed locally. -
Creating & Using .jar files and manifests
I've read through hundreds of online tutorials on creating and using .jar's, but it's surprising how unhelpful they really are.
I've been trying to make a java program of mine standalone, so I can distribute it to others and allow them to run it without use of a compiler, etc (ideally just a .exe or .bat that they double click on). Everything I've found says I need to create a .jar of my program in order to do this. I was finally able to create a .jar but I got different errors relating to "main-class" and "manifest" issues...I tried running it with javaw.exe and had the same problem.
Some tutorials briefly discuss "meta manifest's", other's skip the concept all together in creating .jar's. I created a jar with:
jar cf A2.jar c:\jarTester.java
after changing my command prompt path to
C:\Program Files\Java\jdk1.6.0_01\bin
It created the .jar, but nothing worked. As above, it gave me errors relating to the "Main-Class" and "Manifest". So here's my question:
What involvement does a "manifest" play in .jar's, and how do I create/use one to create a .jar? Why is it necessary to specify the "Main-Class" when I have already done so in my .java file?
I believe that once I can get this "Main-Class" and "Manifest" problem straightened out, I will be able to create a batch file with the line:
java -jar A2.jar
is this correct? THANKS.I've read through hundreds of online tutorials on
creating and using .jar's, but it's surprising how
unhelpful they really are.really, hundreds?
I've been trying to make a java program of mine
standalone, so I can distribute it to others and
allow them to run it without use of a compiler, etc
(ideally just a .exe or .bat that they double click
on). Everything I've found says I need to create a
.jar of my program in order to do this. Make up your mind, do you want to make a jar or an exe?
I was
finally able to create a .jar but I got different
errors relating to "main-class" and "manifest"
issues...I tried running it with javaw.exe and had
the same problem.
Some tutorials briefly discuss "meta manifest's",
other's skip the concept all togetherthat's because the manifest isn't usually necessary
in creating
.jar's. I created a jar with:
jar cf A2.jar c:\jarTester.javaugh, that won't work. you need to put the class file in there, not the source. or you can put the source in as well if you want, but the class is necessary
i'm ignoring the rest of this post for now
go back to Google and type in jar manifest and read more
Maybe you are looking for
-
How can I intro play / auto-skip songs after a set amount of play time?
I'm using iTunes on Windows 7 and I'm curious if there's a way, using iTunes itself or with a plug-in, to just intro play through my playlists. By this I mean, play only the first 30 seconds or so of each song before skipping to the next track. Any h
-
Acrobat 9.4.4 patch stops combine files from MS Word
Yesterday morning, I was able to use the right click and "Combine supported files in Acrobat" repeatedly and just fine. Then the updates came. Unfortunately we installed them on most of the computers in our office (except for one that was off), and s
-
I have macbook 13 2009 i need connect mini displayport to hdmi
hi i need connect this macbook by mini displayport to hdmi how can i do this?
-
hello, I need to cancel technical completion for an order with BAPI BAPI_ALM_ORDER_MAINTAIN, How can I call this ? Could you please help me ? Thanks
-
Send Mail with "read confirmation" via mapi
Hi! I will send a E-Mail with a "read confirmation"... What i mean is that if the Person open the mail that i beome an mail that he open this mail... Under Outlook 2010 via mapi I can set a lot of Parameters but i can not find where i can set the "ma