Invisible class files inside jar archives

Hi!
After developing an application with J2SE 1.4.1_05, under Windows 98, using some packages archived in jar files, I cannot launch the application with the J2RE 1.4.2_02 or J2SE 1.4.2_02 (in the same Windows 98) because the class files in the jars are not 'visible', even if the CLASSPATH is set up correctly. The only classes that work right are the unpacked ones. But it still does work in Windows 2000.
What might be wrong?

Thank you for your answer, and excuse me if my question was kind of confusing.
The issue here is that the files ARE in the jar files (without './' on the front), but in the environment (Windows 98 + J2RE 1.4.2_02) the application does not work, unless I unpack the jars and use the packages in the same manner I did during the development stage (for example, all classes of package 'myutils' in the folder 'myutils').
The weird thing is that this DOES NOT happen in the environment (Windows 2000 + J2RE 1.4.2_02)!!! Just after installing the J2RE 1.4.2_02 under Win2K, the app does work OK! That is why it seems that ONLY in the first case (Windows 98 + J2RE 1.4.2_02) the class files inside the jars seem to be 'invisible' to the environment.
As I have mentioned in my question, the app was developed in the environment (Windows 98 + J2RE 1.4.1_05), and it did still work with the jar files, so I wonder if there might be some compatibility between Windows 98 and the J2RE 1.4.2_02.
Except my own jars, the same thing does happen with the jai_core.jar file coming with JAI 1.1.2. But this does not happen when it comes about rt.jar, in ..\jre\bin!!!
All in all, the question still is: what might be wrong?

Similar Messages

  • Accessing files inside JAR archives

    I have a jar file with structure as follows
    . root directory containing *.class files
    .\dll directory containing *.dll files
    .\images directory containing *.gif and *.jpg files
    Now, when i want to load the dll i use
    System.loadLibrary("dll/sendlib");or to load an image
    ImageIcon i = new ImageIcon("images/"+filename);This works perfectly when the program is not packed in a jar file. I have seen previously that you can use getResourceAsStream(), but in my case it won't work, since it's not class files i'm after. Anyone who have got this to work? Is there some special options in the manifest file that needs to be set, or is the directory structure inside the jar file not the same as outside? How shall i do to load my files?

    if u r using jar file u have to create url object.
    i.e
    URL url = MainclassName.this.getClass ().getResource("/images/"+fileName);
    ImageIcon i = new ImageIcon(url);
    it will work. MainclassName is the name of ur main class
    Paddy

  • How to protect the class files inside jar file.

    Hi Group,
    pls help me.
    my need is i created a executable jar file with certain classes.
    and i'm supposed to send it to my client.
    but if the client needs he can extract the class files from the jar and with the
    help of some decompilers he can convert class file to .java source code and read the whole
    stuff.
    how can i protect my jar file from these.
    is there any security mechanism for that
    pls help me.
    Regards,
    Ranjith.M

    In order to protect my jar file I tried the jar signer technology but it only protects the jar from modification so I need to know how to protect jar file from decoding of the contents inside.

  • How to edit a text file inside jar

    Hi all;
    I have a code that created text file and put this file to other jar archive.
    How can I edit this text file inside jar, add string to this file ?
    Thanks,

    Unpack the jar, edit the file, repack the jar.

  • Classnotfoundexception eventhough the class is inside jar

    Hi guys,
    I encountered weird problem where sometimes it throws classnotfoundexception eventhough the class is inside jar. I terminate the program and start it again then it works fine. I compiled the jar using ant
         <target name="compile" depends="clean" description="">
               <echo message="using java version    : ${java.version}"/>
               <echo message="using ant.java.version: ${ant.java.version}" />          
                 <javac srcdir="${src.dir}"
                        destdir="${build.dir}"
                        debug="on"
                        source="1.5"
                              excludes="com/csg/cs/mud/junit/*"
                 />
                <jar destfile="${mmd.jar}"
                     basedir="${build.dir}"
                     excludes="org/css/cs/mmd/juni*,org/css/cs/mmd/utility/MDDClient.class"
                />          
         </target> it shows :
    *[echo] using java version : 1.5.0_04*
    *[echo] using ant.java.version: 1.5*
    and I deployed this jar to sun solaris (SunOS sg123-456 5.8 Generic_117350-44 sun4u sparc SUNW,Ultra-80) and sun solaris box is using jre1.5.0_06.
    Appreciate any advice please. thanks in advance!
    Cheers,
    Mark
    Edited by: kmthien on Aug 2, 2010 3:05 AM

    Is it public?
    Is it spelt correctly, and the same, in the jar file and the code?
    Is it in its correct package in the jar file?
    Why are you excluding a class from the jar file?

  • How to get the class file of jar file

    hello all,
    is there any way to get the class file of jar file,as we have when we compile a java file we get class file
    same do we have any option to get the class file of jar file

    A jar file is a zip archive, so you can uznip it or extract the contents with the command "jar" - if it is what you need.

  • Access wav-files in jar-archives (URL works, File works not)

    Hi there!
    The un-jar-ed application works fine, but I have a problem with accessing files in jar archives.
    URL url = Classname.class.getResource("testdir/test.wav");works fine (and loading images works this way), but as soon as I try to get the file
    File file = new File(url.getFile());I get an null-exception.
    (in my case, I use the jmf package to play the sound-files, and I get the problem when I try to instatiate the MediaLocator
    MediaLocator mediaLocator = new MediaLocator(url);but I think the problem is the same)
    Thanx for help

    works fine Then keep doing it that way. What's the problem? It's true that you can't access something in a jar archive via a File object, so don't do that.

  • EJB:Error in adding class file in JAR

    Hi im doing project in EJB
    when i add class files to JAR this type error occurs
    Pls help in need of help

    Generally WEB-INF\classes\ is for compiled classes.
    You should move your java source files to say SecondWap\src\com\hclasses to match up with your package name in your ajva file.

  • How to run .class file and .jar file in jdev9i

    I want to run .class file and .jar file in jdev9i,what should I do?
    Also,I want to generate .class file and .jar file in jdev9i,what should i do?

    Add the .class file containing the public static void main(...) method to the project by clicking on the + toolbar button in the navigator, open the project properties and properly set the additional classpath then right click on the .class in the navigator and say run. It should work, I've just tried it.
    Doesn't work for a .jar yet, in JDeveloper 9.0.3 it works both for .class and .jar
    Michel

  • How to use database file within jar archive

    Hi. I'm quite new in Java programming, and I'm wondering if what I did makes sense or not.
    In my applet I'm using a MS Access Database file, which is contained in the same Jar Archive like the Applet class file. I tried and tried to use this Database file directly but it wouldn't work. Than I read in some other forum that it is not possible to use the database file directly within the archive. First question: Is that true?
    Than I desided to extract the DB file in the init() method of my applet to the default temporary foulder. When the program is closed I use the destroy() method to delete it again. Everything works well now. But is this the typical way this is done?
    Thanks for help!

    Hi,
    here is the code which extracts the database file out of the jar archive (the same archive in which the class file is):
    //get the user temporary folder
    File TempFolder = new File(System.getProperty("java.io.tmpdir"));
    //create (empty) db file
    efile = new File(TempFolder, "steelSections.mdb");
    // if database file is not yet extracted
    if (!efile.exists()) {
    //get an input stream for the database file
    InputStream in = new BufferedInputStream(this.getClass().getClassLoader().getResourceAsStream(
    "FaST/db/steelSections.mdb"));
    //create an output stream for the db file on the file system
    OutputStream out = new BufferedOutputStream(new FileOutputStream(efile));
    //-Buffer to copy the data
    byte[] buffer = new byte[2048]; //buffer to copy the binary
    for (;;) {
    int nBytes = in.read(buffer); //read data
    if (nBytes <= 0)
    break; //no more data to read
    out.write(buffer, 0, nBytes); //write data
    out.flush(); //close out and in streams
    out.close();
    in.close();
    If you have the db file in an other jar archive file you need a referenze to the entry in the other jar archive. I'm not sure how to get this, but I'm sure you fill find a solution by searching in this forum...
    Good luck!

  • Issue in .class file in imported archive ESR - after upload using eclipse

    Dear Friends,
    My requirement here is too change existing java mapping. Here I am exporting zip file from imported archive and after making changes in eclipse upload the .JAR file again. Here .class file is not opening after upload in Imported Archive.
    Error is
    Setup I am having on my system.
    -> JDK version on my system JDK 1.6_34
    -> JRE on my system – JRE 6
    -> Using eclipse SDK 4.2.2
    SAP PI servers settings.
    I searched online blogs but no help. Can anybody guide me what wrong am I doing here?
    Thanks.
    Sumeet.

    Thanks for reply..Hareesh.
    -> In Eclipse only 1 warning is coming and no error. I guess Eclipse automatically compile .class file. Is there any way in eclipse to see if compilation is done properly?
    -> I imported few external JAR files and already few JAR files are there in Eclipse(JRE1.6), as shown in fig below. Which JAR file is being user? How can I make sure?
    -> When using Run as option I am not getting any option. Is it normal or did I have to activate some option?
    Please give your views on this.
    Thanks.
    Sumeet.

  • Can't access class files in jar file

    I'm running Eclipse and trying to access class files in a jar file from source. I have added the jar file through Properties/Java Build Path/Add External JARs... but the class files are not visible from my source code. Any ideas what is happening?
    Thanks!

    Depends what you mean by "visible." Are you getting a ClassNotFoundException? If so, your JAR isn't in your runtime CLASSPATH. You should be able to solve that (in Eclipse) by by modifying your project classpath.
    If "visible" means your code is usng a ZIP class to peek inside the JAR & it's not working, best bet is to re-study the ZIP class Javadocs & examine the error messages carefully.
    If this doesn't solve the problem, please provide more details & the specific error message/stack trace you're getting.

  • Use classes from a jar archive from in a jar archive

    Hi, I am making a program and I need some the classes in a certain jar archive for tehm to work. Well my program workes before I add it to a jar be when I make it into one and put the needed jar in it, the program breaks. So does anyone know how to access the class of the jar in my jar?

    Well my program workes before I add it to a jar be when I make it into one and put the needed jar in it, the program breaksIt might be easier not to nest the jar files. Instead make the "needed" jar part of the class path when you make your jar file's manifest.
    [http://java.sun.com/docs/books/tutorial/deployment/jar/downman.html]

  • Opening html files inside jar

    Hi,
    I'm making a program where i have a set of help files in the form of html and i would like to open them when the user clicks the "Help" button and I used this code at first
    try
         Desktop.getDesktop().browse(new URI("resources/html/help.html"));
    catch (Exception ex)
         JOptionPane.showMessageDialog(null, "Could not open help.html in default browser\n", "Error", JOptionPane.ERROR_MESSAGE);
    }However after I made the jar and tried to execute on another computer however, it wouldn't work and would display the error message. I was wondering if there was some way that I could open the help.html in their default browser, or maybe a frame if that works, from the jar and have my program still be platform independent?

    ok so i just realized that it doesn't make sense for a program outside the jar, like IE or Firefox, to be able to access and open a file inside of the jar. I am now looking for suggestions on how to work around this problem for my program to be able to have a simple help system located inside the jar that can be loaded during runtime.
    Thanks for your suggestions.

  • Validating xml-files inside jar-files  for JWS

    I want to use xml-files inside a jar-file and want to validate them with dtd-files,
    located in the same jar-file. This does work, but only as long as the dtd-file is
    in the same directory as the xml-file.
    For example, I have no problem, with a DOC Type-statement like
    <!DOCTYPE questestinterop SYSTEM "ims_qtiv1p1.dtd" >
    With this statement, however, one needs an approprate dtd in every directory containing an XML-file of that type.
    If however i want to gather the necessary dtd's in a directory one (or more) levels above with a DOCTYPE-statement of the form
    <!DOCTYPE questestinterop SYSTEM "../ims_qtiv1p1.dtd" >
    I get error messages of the form
    java.io.FileNotFoundException: JAR entry Mikro/Marshall/BookQuestions/../ims_qtiv1p1.dtd not found in C:\Dokumente und Einstellungen\wreiss\Anwendungsdaten\Sun\Java\Deployment\javaws\cache\http\Dwiwi.upb.de\P80\DM~vwl08\DMOViSS\DMoviss_current\RMMikro.jar
         at org.apache.crimson.parser.Parser2.fatal(Unknown Source)
         at org.apache.crimson.parser.Parser2.externalParameterEntity(Unknown Source)
         at org.apache.crimson.parser.Parser2.maybeDoctypeDecl(Unknown Source)
         at org.apache.crimson.parser.Parser2.parseInternal(Unknown Source)
         at org.apache.crimson.parser.Parser2.parse(Unknown Source)
         at org.apache.crimson.parser.XMLReaderImpl.parse(Unknown Source)
         at org.apache.crimson.jaxp.DocumentBuilderImpl.parse(Unknown Source)
         at javax.xml.parsers.DocumentBuilder.parse(Unknown Source)
         at oviss.competenceCenter.XMLExpert.setElements(XMLExpert.java:245)
    though the dtd-file is in the parent-directory (inside the jar) and the unpacked xml-file can be successfully validated.
    Why does this happen. How can one use a single dtd for multiple xml-files (of the same type) in different directories?.
    Thanks
    Winfried Reiss

    In reply to myself, replacing the HTMLBrowser constructor with this;
    public HTMLBrowser()
                  URL url;
                  try
                       // Construct the URL
                       url= this.getClass().getResource('/'+dir+'/'+startPage);
                       setPage(url);
                  catch (Exception e)
                  System.out.println( "Problem setting help homepage");
                 setEditable(false);
                 addHyperlinkListener(new LinkListener(this));
            }made it work. This is because seemingly you need '/' at the start of the resouce's path and '/' as the separator, regardless of platform.
    I hope this helps someone else.
    John

Maybe you are looking for

  • Creation of new employment status

    Hi, We want to create new Employment Status similar to "0" - Withdrawn.  This status should have same features like status "0". I have created a new status "4" and assigned the same to an action. However, the attributes of the new status "4" are not

  • Warning: ORA-16829: fast-start failover configuration is lagging

    Hi I got waring for fast_start failover configuration DGMGRL> show configuration Configuration - activefailover_migdb Protection Mode: MaxPerformance Databases: migdb - Primary database Warning: ORA-16829: fast-start failover configuration is lagging

  • ReadLine Returns What on No Input?

    I'm trying to grab user input (numbers) and I want to be able to process them. I'm looking for a way to insert a default value into the storage variable if the user just hits 'Enter' (e.g. enters no input), but the code either pitches a fit or doesn'

  • Make links look like form-submit buttons?

    How can I make normal links look like form-submit buttons? Is there a css solution? If not how do i write the html so the button is a link but appears as a button? Just so you know what I mean by 'button', im talking about how the 'Post Message' and

  • :censored: cant MSI fix this mess up?

    [size=17]I am so tired of it already. My 645E Max2 is so crappy. First it says my keyboard is connected incorrectly in PS2 then tells me to press F1 to continue. Then is takes forever to auto detect my HDDs. Next is that it always crashes at default