How add ant.jar in to the Java on the NW65 ?

Server: NW65SP8
Step-1: i do this in the NetWare console:
javac -d SYS:\JAVA\classes -classpath SYS:\JAVA\ksrlib\ant.jar SYS:\JAVA\classes\ZipTest.java
ZipTest.java have this strings:
mport org.apache.tools.zip.ZipEntry;
import org.apache.tools.zip.ZipOutputStream;
import java.io.*;
import java.util.zip.Adler32;
import java.util.zip.CheckedOutputStream;
public class ZipTest {
public static void main(String[] args)
throws IOException {
All without errors. After this i see file:
sys:\JAVA\classes\ZipTest.class
Step-2:
run this ZipTest :
java ZipTest
And in the Loggerscreen i see this error:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/tools/zip/
ZipOutputStream
at ZipTest.main(ZipTest.java:24)
java: Class ZipTest exited with status 1
Please, help me found my error.
Serg

Thanks all for advise.
At this tie all work.
this was my steps:
1. in the my SLED11 move from eclipse to NetBeansIDE6.8
2. download add to the SLED11 and configure in the NetBeans for use:
/home/ksr/bin/j2sdk-1_4_2_18/j2sdk1.4.2_18 as JDK1.4
3.Configure NetBeans for use ant.jar in the myzip Project
4. this my source:
* To change this template, choose Tools | Templates
* and open the template in the editor.
package myzip;
import org.apache.tools.zip.ZipEntry;
import org.apache.tools.zip.ZipOutputStream;
import java.io.*;
import java.util.zip.Adler32;
import java.util.zip.CheckedOutputStream;
//import java.util.Calendar;
import java.util.Date;
//import java.util.TimeZone;
import java.text.SimpleDateFormat;
//import java.util.*;
public class Main {
public static void main(String[] args) throws IOException {
System.out.println("\nInside the java program.");
System.out.println("You passed : " + args.length + " parameters.");
for (int i=0; i<=args.length-1; i++) {
System.out.println("Parameter # " + (i+1) + "\tValue = " + args[i]);
System.out.println("SourceDir="+args[0]);
System.out.println("DestinationFile="+args[1]);
//+ + + + + + +
//Calendar c=Calendar.getInstance();
Date dtn = new Date();
SimpleDateFormat dtnf = new SimpleDateFormat("yyyyMMdd");
String NameZip = args[1];
NameZip=NameZip+"_"+dtnf.format(dtn)+".zip";
//System.out.println("="+ dtnf.format(dtn) );
//System.out.println("="+ NameZip );
ZipOutputStream zipOutputStream = null;
File rootFile = new File(args[0]); // sysdata://test
System.out.println("\nrootFile: "+rootFile+"\n");
String pathPrefix = rootFile.getAbsolutePath().substring(0, rootFile.getAbsolutePath().lastIndexOf(System.getP roperty("file.separator")));
System.out.println("pathPrefix: "+pathPrefix+"\n");
System.out.println("pathPrefix-length: "+pathPrefix.length()+"\n");
//File zipFile = new File("/home/ksr/test1.zip"); // sysdata://test.zip
File zipFile = new File(NameZip);
System.out.println("zipFile: "+zipFile+"\n");
try {
zipOutputStream = new ZipOutputStream(new CheckedOutputStream(new FileOutputStream(zipFile), new Adler32()));
zipOutputStream.setEncoding("CP866");
putZipEntry(zipOutputStream, rootFile, pathPrefix.length());
} finally {
if (zipOutputStream != null) {
zipOutputStream.close();
private static void putZipEntry(ZipOutputStream zipOutputStream, File file, int pathPrefixLength) throws IOException {
if (!file.isDirectory()) {
zipOutputStream.putNextEntry(new ZipEntry(file.getAbsolutePath().substring(pathPref ixLength)));
InputStream in = null;
try {
in = new DataInputStream(new BufferedInputStream(new FileInputStream(file)));
byte[] bytes = new byte[(int) file.length()];
int iCount;
while ((iCount = in.read(bytes)) != -1) {
zipOutputStream.write(bytes, 0, iCount);
} finally {
if (in != null) {in.close();}
} else {
File[] childFiles = file.listFiles();
for (int i = 0; i < childFiles.length; i++) {
File childFile = childFiles[i];
// ++++
//add for check file size > 0 or this is i directory
if ( ((childFile.length() != 0) && childFile.isFile()) || childFile.isDirectory() ) {
putZipEntry(zipOutputStream, childFile, pathPrefixLength);
And at this time - all work !
Problem with "Exception in thread "main" java.lang.NoClassDefFoundError:" -
resolved after use in the NetBean JAVA1.4
Problem with applycation freeze anc CPU utilization up to 100 % - resolved after add check:
if this is a file and file size >0 or this is a directory , then zip
else - SKIP
Serg

Similar Messages

  • How do I add a jar file into the build path of the compiler?

    Hey,
    I'm trying to import a jar file into the build path of the compilation process, but it does not find the packages or the classes that are in it.
    I think I don't add it right...
              ArrayList<String> options=new ArrayList<String>();
              options.add("-d");
              options.add(targetDirectory);
              options.add("-classpath");
              for(String str:includeDirectory)
                   options.add(str);
              if (!compiler.getTask(writer, fileManager, diagnostics, options, classes, compilationUnits).call());
                    ....and I've tried this way:
         public void setTargetDirectory(String targetDirectory) {
              this.targetDirectory = "-d " + targetDirectory;
         private void compile(Iterable<? extends JavaFileObject> compilationUnits) throws Exception {
              ArrayList<String> options = new ArrayList<String>();
              options.add(targetDirectory);
              String classPath="-cp ";// tried this also with "-classpath"
              for (String str : includeDirectory)
                   classPath+=str+":";
              options.add(classPath);
         if (!compiler.getTask(writer, fileManager, diagnostics, options, classes, compilationUnits).call())
              // throw new Exception("Compilation Error");
         }Thanks in advance,
    Adam.
    Edited by: Adam-Z. on Feb 24, 2010 5:41 AM
    Edited by: Adam-Z. on Feb 24, 2010 5:42 AM

    Thank you for your reply,
    Q: Are there .class files in that directory in that jar file? (the compiler doesn't ( can't )) look for directories, it can just look for specific files , and scan to get a list of all files matching certain criteria. So if there are no class files, it will say the package doesn't exist, even if there is a directory, possibly containing other files.yes there are class files in the jar, the tree structure:
    j2MeDataChunkGenerator_Plugin\(lots of class files)
    META-INF\manifest.mf
    and thats it.
    , your code will only work on windows because other platforms use a different path separator. You should use java.io.File.pathSeparator not explicit ';" when building your classpath. (this is unrelated to your problem, but you should correct it)will do, thanks.
    Q: Is that error in your post formatted by your own diagnostics? (we could possibly help you better if we didn't have to guess!!)I would not post my own error code, this text is generated by the compiler diagnostic.
    {code}
         System.err.println(" Error details: " + diagnostic.getMessage(null));
    {code}
    Q: Is line 3 of ImageCroper_Editor.java (sic) an import statement? (we could possibly help you better if we didn't have to guess!!)it is an import error... didn't the error message stated that it is an import problem? wired, I'm sure before it did. anyway it is an import error.
    Also you don't show us what the variable includeDirectory is in terms of type, and contents, that might be helpful. (we could possibly help you better if we didn't have to guess!!)It has only one String object: "D:\%Important Documents\WorkSpaces\PacMan\ApplicationManager\Plug-in\Data Chunk Designer.jar"
    the last file on the classpath list.
    Q: Have you proven this? that i did post, in this long line of text.
    Q: Is the compiler finding other classes (in other packages) in that same jar file?No. all the class files are in the jar, they all have entries that start with "j2MeDataChunkGenerator_Plugin\*.class", and since I get 47 errors I guess it does not load any other class.
    thank you for you comments, the problem with having these errors, is that I can't even get a piece of information where this error is coming from, only that it is an import loading error package not found, what does that mean? that the jar was not loaded in compilation(no error about this), that the jar is corrupted(no error about this), that the path is incorrect(it is correct I made sure), that there is no such package in the jar(There is), that the compiler does not load the package(does it even do that?), really I can't even guess why this happens, I've been at this on and of all day today, really annoying.
    Thanks,
    Adam.

  • Everytime need to add jxl.jar before rebuilding the project

    Hello,
    Everytime I have to add jxl.jar in the workspace before rebuilding the project as its path is lost.
    Is there any way out to resolve this problem??
    Thanks n Regards,
    Mandeep

    hi..   
    If you want to add external jar files ...
    and If your WD components are in DCs then you may simply solve the problem by creating External Library DCs and as usual, create a public part out of it and add to the dependencies of your WD DC.
    Follow the following steps  to create an External library and adding it to your dependent DC
         1)Go to File->New->Developmentcomponent
         2)In Window opened select Mycomponents and click Next
         3)In the Window opened Give Name(for example ExcelLib) for                                                external library    and select Type as External Library
         4)Click on Finish
    The  External Library  created is visible in Navigator perspective but not in WebDynpro Explorer perspective
         5)In the folder libraries of the externallibrary(ExcelLib) you paste the jar  file (jxl.jar).
         6)Right Click on the jarfile that you have added in the libraries folder of the  External Library ,go to Developcomponent -
    >add to public part
    7)In the widow opened give the some name  for puplic part and say ok 
    8)Now Right click on the ExternaleLibrary ,Goto DevelopmentComponent --->build
    After build is completed this External Library Dc can be used by other DC As
    Used WebDynpro Components ..where the jar file features ca be accessed    
    Regards
    Madhavi

  • How to add a jar file in the visual Age classpath

    I have to import a jar file in visual Age workspace, and don't know hox to do
    I tried several things, but didn't succeded at this point.
    I need to succed until tomorrow for completing my work.
    Please help, thanks.

    Pls do the foll actions:
    Step 1:
    File -> Import -> Selct radiobutton - "Jar file" -> Next
    -> Select the file name(ur jar file) - > click on the java button and ensure that u have selected all the file or what evre files u want " -> Finish
    If at all u r not getting any errors but the files are not apperaring in ur Project means go to
    Step 2:
    From the work bench click
    Window -> Reposiroy Explorer -> Select the Project,edition,package or type and right click and from the pop up menu click "Add to Workspace"
    This 'd work
    All the best for a successful completion of ur work
    Pramod

  • How to reference JAR files in stored java class ?

    I don't know if it's exactly the right place to post this, I hope it could be :-)
    Here is the problem :
    I developped a Java class with some public static functions.
    To store this class in Oracle, I use the SQL below :
    CREATE OR REPLACE AND COMPILE JAVA SOURCE NAMED "SYSTEM"."MYCLASS" AS
    // ... (Java source code) ...
    This works pretty well with simple functions, but we need to import specific class. Here is for MQSeries : import com.ibm.mq.*;
    When using the SQL to put the Java class, we get an error message saying that the class wasn't correctly compiled. It seems it's about the import.
    The question is : how to proceed to reference the JAR files needed so that my class can correctly import the needed packages ?
    Thanks in advance,

    Here is a simple example of code :
    CREATE OR REPLACE AND COMPILE JAVA SOURCE NAMED "SYSTEM"."TEST" AS
    import com.ibm.mq.*;
    public class Test {
    public Test() {
    try{
    MQQueueManager manager = new MQQueueManager("");
    catch(Exception e){
    In this way, I get message "Warning : Java create with compilation errors".
    When I comment the line of the MQQueueManager object creation, it is well created.
    Any ideas ?

  • How to make jar files run using java.exe and not javaw.exe

    Hi ,
    I am developing a project in which there is an GUI which inturn will call a console . I have made it into an jar file now.
    Here comes the problem. When i run the jar files , i don't get a console. While going through this forum, i came to know that jar runs using javaw.exe and this stops it from bring the console up.
    Please suggest me a way of running the jar file through java.exe or any other method by which i can get an new console poping up.
    PS : i cannot start the application itself in a system console , because the Console mode is an added feature and it is not to be displayed every time but only when the user intends to.

    Thanks for the reply pbrockway2. But i think, i was not able to convey my problem properly.
    I am supposed to start my application in a GUI mode ( No console are should be present at this point of time). Within the GUI , i have a option for working in the console ( i.e if console is choosen, then i start giving my output and take inputs from the console. I am trying to do this by just calling the "System.out "and "System.in" methods. )
    Here is the problem. As i have started it through " jar " it would not have a associated console with it.
    PS: i cannot have launching .bat file because that would result in my application having a console displayed at the very start of the application. I want the console to be displayed only when the user wants to start in console mode.
    Please suggest me some ways of doing this. Can i create a console from my java program and then exit it.

  • How add a new icon in the title bar?

    does anyone know how to change the default "java icon" that appears on the title bar of a Window (in an application Frame)?

    Hi,
    use the method public void setIconImage(Image) in Frame (inherited by JFrame).
    best regards

  • How to add external jars in the configuration of JSmooth?

    Hello,
    I am trying to create an exe file from a java program using JSmooth.
    The program is a simple hello world proogram.
    I am developing under eclipse, and I am using some external jar files as libraries.
    If my program is simple,; it works fine. If I add an import of a class that is in one of these jar files, I get the following error when executing the created .exe file:
    "Could not find the main class. Program will exit".
    I guess I have to add this Jar file to the path for the creation of the .exe file.
    My question is: does anybody know HOW to add an external jar in the configuration of JSmooth for the creation of an exe file from a Java program?
    Thanks for your help
    Philippe

    i have the same problem phsans
    you know the answers??
    thanks phsans:D

  • How to load Jar Files on demand

    Hi all.
    As must of you probably know, JAR files are downloaded on the initial phase when the first form is requested from the URL. This is done through the archive parameter.
    Although i recognized the advantage of such technique, there may be times, when one would wish to download certain JAR files when really needed.
    For example, the FormsGraph.jar may be needed only with certain form modules, but probably not for most. So my question is, apart from doing a web.show_document and calling the desired form with the appropiate config section, is it possible to download specific JAR files on demand???
    Thanks in advance ...!

    This is not really an "Oracle Forms" question. This is more of a java applet question that can be discussed in the Java forums.
    https://forums.oracle.com/forums/category.jspa?categoryID=285
    However, as far as I know, jar files are pulled on demand. You can easily test this with a simple form. For example, add any jar file to the ARCHIVE parameter in formsweb.cfg. Then open the JRE Control Panel and clear the cache. Now run the provided test form (test.fmx):
    http://server/forms/frmservlet?form=test
    Once the form has successfully started, open the JRE Control Panel again and open the Cache Viewer (General tab > View). Notice that the only files downloaded and cached are frmall.jar and Registry.dat. You may see a reference to your additional jar in the console, but the file was not brought down to the client. If you are seeing that a jar is being brought to the client with your own form, this is likely because your form is coded such that some code in that jar is being called and therefore is needed.

  • How to build a small application using Java API

    Hai expertise,
         I want to retreive MDM repository info using JAVA API, i am following these blogs:
    /people/andreas.seifried/blog/2006/03/26/performing-free-form-searches-with-mdm-java-api
    /people/udi.katz/blog/2005/08/21/retrieving-data-from-mdm-server-using-the-mdm-java-api
    /people/udi.katz/blog/2005/07/17/mdm-connectivity-to-java-application
    <b>where to get the jar and sda files to build the application??
    In Developer Studio.. Windows -> Preferences -> Java -> Classpath variables. Is this the only place where we need to give the jar file path??
    Are there any other configurations to do(except setting container variable to MDM4J jar file) to connect my java application to MDM repository???</b>
    Regards,
    Chand.

    Hi Govada,
    (1)You need to add the MDM4j and other JAR files at:-
    right click on project -> Java Build Path -> Libraries -> Add External JARs
    (2)If the project is Web Dynpro project one
    then right click on project -> Web Dynpro Reference -> Library Reference -> and add sap.com/com.sap.mdm.tech.mdm4j
    Are you using JAVA API 1 or 2???
    Thanking you
    Namrata Dixit

  • How to initialize a replica by using Java API?

    Hi, I used to initialize a replica by adding the attribute nsDS5BeginReplicaRefresh=start to the replica agreement and it works fine by using the ldapmodify commandline utility. Now I am trying to use the Java API to do the same, but I always get the Object class violation error. And I noticed that when I use the Java API to create the replica, it has the different attributes than the one created by the commandline utility. The former has the serializedJavaData and javaClass, ... And I can't find any documentation on this issue. It's really frustrating! I am wondering if the replica agreement has different attribute for initializing? If so, why it's never documented?
    I badly need your help!!!
    Louis

    Hi Govada,
    (1)You need to add the MDM4j and other JAR files at:-
    right click on project -> Java Build Path -> Libraries -> Add External JARs
    (2)If the project is Web Dynpro project one
    then right click on project -> Web Dynpro Reference -> Library Reference -> and add sap.com/com.sap.mdm.tech.mdm4j
    Are you using JAVA API 1 or 2???
    Thanking you
    Namrata Dixit

  • How to make jar

    hi
    i have a folder name cdma in that i have classes and one folder named images.
    i use to get the image as follow
    JLabel label=new JLabel(new ImageIcon("images/abc.gif"))
    now i want to make the jar file which i put on the desk top and by double clicking the application run.
    i make Manifest file as
    Main Class: Mymain
    but i do not know how the image folder add in jar for getting the images from image folder.please help me with statements.
    thanks

    Just add it. A JAR is nothing but a zip file.
    Resources are loaded from JARs using Classloader's getResource("/images/abc.gif") or getResourceAsStream() methods.

  • How do I add my own JAR file to the classpath?

    When I put a JAR file containing several compiled Java classes in the '/opt/SUNWips/lib' directory they are not found while compiling a JSP-Provider. When I extract them from the JAR it is not a problem (I think because the '/opt/SUNWips/lib' directory is already in the classpath).
    Where can I add my JAR to the classpath?

    I have been successfully editing the jvm12.conf file to add jars. This is
    the web server config file in
    /opt/netscape/server4/http-your.server.com/config directory. Add to the
    jvm.classpath line with all the other jars. Yes, lib is in the path, but
    Java doesn't see inside the jars unless they are explicitly in the path.
    "Ulf Licht" <[email protected]> wrote in message
    news:[email protected]..
    When I put a JAR file containing several compiled Java classes in the
    '/opt/SUNWips/lib' directory they are not found while compiling a
    JSP-Provider. When I extract them from the JAR it is not a problem (I
    think because the '/opt/SUNWips/lib' directory is already in the
    classpath).
    Where can I add my JAR to the classpath?
    Try our New Web Based Forum at http://softwareforum.sun.com
    Includes Access to our Product Knowledge Base!

  • How to add a web site to the "Java" preferences?

    Apple states the following regarding Safari 6.0.4:
    "When you first visit a website that requires the Java web plug-in, Safari presents a prompt similar to this one but containing the specific website ..."
    I didn't authorize a web site when i first visited it. Now, I'd like to add this web site to the list in the "Java" preferences in Safari 6.0.4.
    Is this possible and how?
    Thanks in anticipation.

    I noticed certain features simply do not happen in Safari with Java turned off when I recently changed ISPs and was making change of address at sites that had been using the earlier one. In several instances I clicked "Submit" or the like and got exactly no feedback. Which made no sense. Then, two days ago, in trying to price some Adobe software, when I clicked on a button for more information, again nothing happened. I went to Chrome, pasted the URL, clicked on the button and got a drop down information window.
    I came here because, when I went through the Help symbol at Preferences>Security but got no helpful instructions, so I wrote an explanation in the comment box, but when I clicked Submit THERE I got an error message that included something about a Java exception. I enabled Java and went back to try Submit again, with the same error!
    For the record, here is what I was trying to send to the comment-readers:
    Wanting to control where Java can be run, I clicked on "Manage Website Settings" and got an empty list.
    So I clicked on the Help button on the Preferences>Security page and came to help, which told me NOTHING about HOW to enter websites on that list, that empty list.
    Therefore, no help.
    Hunh! In trying to send this apparently I need to have Java turned on. See? That's just another indication of confusion out here in user land.
    Well, that didn't work either. I will try another route.  END OF NOT-SENDABLE COMMENT.
    Now I will web search for useful information. I have chosen to be kept abreast of this discussion, too.

  • How to refer a .jar file in the code.

    How to refer a .jar file in the code.
    I want to use a library dnsjava.jar, which I download from the internet. I want to know how to refer it
         If I am compiling the code on Solaris
         If I compiling the code on windows using eclipse.
    I added the following line in my code to refer to this library. But it always complains of not found the class
    import org.xbill.DNS.*;
    I tried the following to add this library but did not work
    On eclipse/windows: Went to window-> preferences -> BuildPath _> class path Variable.
    On Solaris: Could not add this library /opt/java_reference/v1.6.0_04/jre/lib. Although I am logged in as root, but not able to add the library there. Complains of Permission denied.

    Set the classpath option when compiling.
    javac -classpath /path/to/lib/dnsjava.jar YourProgram.java
    I don't use Eclipse, but it probably has a library list on your project preferences. Add it there.
    Regards,
    Henrique Abreu

Maybe you are looking for