Confused about CLASSPATH and how java handles import statements...

Hello,
I must admit I don't get it. I read the articles about setting CLASSPATH etc. but I still wonder:
If you use an import statement, what does the compiler do? I.e. where does it look for the specified classes? I find it confusing because I see in different locations different .jar files:
C:\jdk1.3.1_03\lib\dt.jar
C:\jdk1.3.1_03\lib\htmlconvertor.jar
C:\jdk1.3.1_03\lib\tools.jar
and also
C:\jdk1.3.1_03\jre\lib\i18n.jar
C:\jdk1.3.1_03\jre\lib\rt.jar
C:\jdk1.3.1_03\jre\lib\jaws.jar
C:\jdk1.3.1_03\jre\lib\sunrassign.jar
Can someone explain me what the purpose is of these files?
And why do I have the same contents in
C:\Program Files\JavaSoft\JRE\1.3.1_03\lib
and in
C:\jdk1.3.1_03\jre\lib
Why is that?
Thanks for answering my questions!
-mike

Thanx for the answers, but I still wonder, everyone
here says I need to set the classpath, but I don't.Probably because your classes are already in the class path. The compiler/jvm also look for classes by themselves not just in jar files, when just a directory is supplied in the class path. And a period (".") is a valid directory.
Programs importing different classes compile with no
problem. So what's up with that?
Presumably you are referring to your own code - because they are in the class path.
Second, I still don't understand why the runtime needs
the .jar files. The runtime uses classes, like String, that have to come from somewhere.
This would also mean that end-users
need to set the classpath to the .jar files in their
JRE directory to be able to run programs that import
classes from these .jars. But this is not true, right?No it is true. The end-users will have to set the class path. There are variations on this which make it seem like no class path is set. For instance applets in a browser are java but the end-user does not need to set a class path. That is because the browser knows how to download classes/jars and how to set it up so it uses them. (Actually it uses a class loader, but that is probably more information that you need.)
Because if I make some nice classes myself and import
them, how can I expect my end-user to install these
classes and make a classpath for them?That would be between you and you end-user.
First installation is not part of java. For installation you will have to find something outside of java to accomplish the goal.
Additionally how the class path gets set is OS specific. Java does not deal with that. You will also have to find some way to deal with this (most likely part of the installation.)
There are also variations on this. For example the browser example I gave above. Or using the ext directory. Or creating an executable jar. Or simply setting the class path.
In my understanding it should only be needed in the JDK, not
in the JRE. True or am I mistaken?Mistaken. The class path is needed in the JRE as well. You will need to set it.

Similar Messages

  • Confuse about ADS and How to check ADS in NW7.0

    I confuse about ADS. It's a separate software from NW 7.0 or integrate when install NW7.0 . How to check ADS in NW7.0.
    Thanks in advanced

    Everything here : https://www.sdn.sap.com/irj/sdn/adobe
    Summary: installed with NW7.0, you must configure it. See config guide how to check it.

  • I am confused about something.  How do I read a book on my MacBook Pro?  I can't find the iBook app anywhere, which is what I use on my iPad.  The book I want to read is in my iTunes but I can't click on it.  My iBook library does not show up in iTunes.

    I am confused about something.  How do I read a book on my MacBook Pro?  I can't find the iBook app anywhere, which is what I use on my iPad.  The book I want to read is in my iTunes but I can't click on it.  Some of my iBooks show up in my iTunes but they are "grayed" out.  The only books that respond in iTunes are audiobooks and that's not what I'm looking for.  Is this a stupid question?

    Nevermind - I answered my own question, which is I CAN"T READ ANY BOOKS I purchased in iBooks on my MacBook Pro.  If I want to read on my mac I have to use Kindle or Nook.  Which means any book I've already purchased through iBooks has to be read on my iPad.  Kind of a drag because there are times when it's more convenient for me to read while I'm sitting with my Mac.

  • Is there another way of getting apps from the appstore without putting your credit card number in, ive heard about the itunes gift card thing can anybody just give me more info about that and how i can buy free things free things from the appstorepls help

    Is there another way of getting apps from the appstore without putting your credit card number in, ive heard about the itunes gift card thing can anybody just give me more info about that and how i can buy free things free things from the appstore...pls help as im only a teenager and have no credit credit and my parents dont trust me with theres and they dont care about the fact that you can set up a password/.... PLEASE SOMEONE HELP I WILL BE SO GRATEFUL... And i would really like to get the iphone 4 but if there is no way of etting apps without your credit number then i would have to get a samsung galaxy s3 maybe ...

    You can set up an Apple ID without a credit card.
    Create iTunes Store account without credit card - Support - Apple - http://support.apple.com/kb/ht2534

  • I want to know about imessages and how it works !! how to register a number with imessages?? I saved a number in contacts but when I try to send a message it say "! not delivered" in red mark.How can I fix this problem??

    I want to know about imessages and how it works !! how to register a number with imessages?? I saved a number in contacts but when I try to send a message it says "! not delivered" in red mark.How can I fix this problem??

    Perhaps something in this support article will help:
    http://support.apple.com/kb/TS2755
    Regards.

  • TS3989 Only some of the photos I have taken on my iPhone appear in the photo stream on my iPad even thou they were taken at the same time. Why is this and how can I import the other photos from my iPhone to my iPad?

    Only some of the photos I have taken on my iPhone appear in the photo stream on my iPad even thou they were taken at the same time. Why is this and how can I import the other photos from my iPhone to my iPad?

    If older photos are missing it may be because photo stream photos are only held in iCloud for 30 days.  After that they are removed from iCloud but will remain (up to 1000 photos) on your device until deleted.  Also, only photos taken after enabling photo stream are added to your photo stream, and only when the camera is closed, your device is connected to wifi and you have at least 20% battery life remaining.
    To transfer the missing photos you can either create a shared photo stream containing them and invite yourself to it (see http://help.apple.com/icloud/#mmc0cd7e99), import the photos to your computer and sync them to your iPad, or use an app like PhotoSync to transfer them to your iPad over wifi.

  • I figured out how to snap a still photo of a movie clip, but where then does it go, and how can I import it into my iPhoto library?

    I was working in iMovie and discovered how to take a still photo of a movie clip.  Now I can't find that still photo!  Where did it go, and how can I import it to my iPhoto library?

    Just found out and it is simple.  When you find a frame in your video/movie of which you want a still photo or screen shot, just go to the frame and click on command, shift and the #3 in quick succession.  You will hear a "click" like a camera taking a photo.  The screen shot will then go to your desktop where you can drag it to iPhoto or an e-mail, or anywhere you like.  Also you can rename the screen shot by double clicking on the wording under the screen shot on your desk top. Whew!

  • [svn:fx-trunk] 10545: Make DataGrid smarter about when and how to calculate the modulefactory for its renderers when using embedded fonts

    Revision: 10545
    Author:   [email protected]
    Date:     2009-09-23 13:33:21 -0700 (Wed, 23 Sep 2009)
    Log Message:
    Make DataGrid smarter about when and how to calculate the modulefactory for its renderers when using embedded fonts
    QE Notes: 2 Mustella tests fail:
    components/DataGrid/DataGrid_HaloSkin/Properties/datagrid_properties_columns_halo datagrid_properties_columns_increase0to1_halo
    components/DataGrid/DataGrid_SparkSkin/Properties/datagrid_properties_columns datagrid_properties_columns_increase0to1
    These fixes get us to measure the embedded fonts correctly when going from 0 columns to a set of columns so rowHeight will be different (and better) in those scenarios
    Doc Notes: None
    Bugs: SDK-15241
    Reviewer: Darrell
    API Change: No
    Is noteworthy for integration: No
    tests: checkintests mustella/browser/DataGrid
    Ticket Links:
        http://bugs.adobe.com/jira/browse/SDK-15241
    Modified Paths:
        flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/DataGrid.as
        flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/dataGridClasses/DataGridBase .as
        flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/dataGridClasses/DataGridColu mn.as

    Hi Matthias,
    Sorry, if this reply seems like a products plug (which it is), but this is really how we solve this software engineering challenge at JKI...
    At JKI, we create VI Packages (which are basically installers for LabVIEW instrument drivers and toolkits) of our reusable code (using the package building capabilities of VIPM Professional).  We keep a VI Package Configuration file (that includes a copy of the actual packages) in each of our project folders (and check it into source code control just as we do for all our project files).  We also use VIPM Enterprise to distribute new VI Packages over the network.
    Also, as others have mentioned, we use the JKI TortoiseSVN Tool to make it easy to use TortoiseSVN directly from LabVIEW.
    Please feel free to contact JKI if you have any specific questions about these products.
    Thanks,
    -Jim 

  • Nation advanced search on my IMac, which I think is a spyware. When I want wo go to google chrome it redirects me to this ominous nation search engeen. Has anybody got some information about it and how I can get rid of

    I just caught a thing called nation advanced search on my iMac computer, which I think is a spyware. When I want wo go to google chrome it redirects me to this ominous nation search engeen. Has anybody got some information about it and how I can get rid of it? What does can it do to my data and is it really a spyware? I just found information in youtube, that it is a spyware, and that it has to be removed, but the information they give for the removal is just working for PCs not for Macs.
    Please help!

    Thank you all for the friendly assistance provided.
    I have found a solutiton to the problem I was having.  I hope that many more can benefit from the information I will provide.
    I started at Finder, then went to GO selected COMPUTER and then Machintosh HD, then Library, Scripting Additions folder and trashed all that was there. This is what worked for me, if you choose to not delete your content its up to you.  Happy Computing.
    God Bless!!
    This solved my question 

  • I have Calendar v 7.0 and Entourage 12.3.6 2008 on OS X 10.9.2. I cannot import Entourage events into Calendar - this was never an issue with iCal. Whats happened and how can I import details into Calendar or do I need iCal back?

    I have Calendar v 7.0 and Entourage 12.3.6 2008 on OS X 10.9.2. I cannot import Entourage events into Calendar - this was never an issue with iCal. Whats happened and how can I import details into Calendar or do I need iCal back?

    adamboettiger wrote:
    Sophos and MacKeeper
    There are many reported problems with both these programs.
    Run through this list of fixes in order, will tune you right up.
    They are in order for a reason.
    ..Step by Step to fix your Mac

  • Oracle wallet manager and how can I import a .cer f

    Hi where can I download oracle wallet manager and how can I import a .cer file to a wallet file .p12 that OAS uses in Apache configuration.

    Hi where can I download oracle wallet manager and how can I import a .cer file to a wallet file .p12 that OAS uses in Apache configuration.

  • HT201320 I am having trouble with password. Forgetting password,as I have many mail IDs like yahoo,gmail,hotmail,apple, I cloud etc.,thus confusing about password and restating through procedures. The altered password is not accepted I Safari

    I am having trouble with password. Forgetting password,as I have many mail IDs like yahoo,gmail,hotmail,apple, I cloud etc.,thus confusing about password and restating through procedures. The altered password is not accepted I Safari. When I want to open my mail but window appears as incorrect password though the mail appears on the left. however whe I go to my mail separately opening my mail, without mail icon in my pad.

    I'm having the same problem, what did you do?

  • Import problems and how to handle a bad crash

    Hello,
    I am working on a system that I "inherited" because I am the only person left who has any idea about how it is supposed to work. :(
    Configuration:
    Oracle Base Version: 9.2.0.1.0 & OUI patch 2.2.0.2.20 & Oracle Patch 9.2.0.3.0
    Operating System: Windows 2000 Server
    Situation:
    The SCSI controller on the mainboard failed taking the primary hard drive drive with it and damaging the HDD controller for the secondary drive. Thankfully I was able to bring the secondary drive back up online and get to the mirror which I immediately copied to a backup location. Unfortunately getting the mirror drive to be bootable under server2K has not been successful so I am focusing on recovering the data at this point.
    Problem #1:
    Incredibly Rare backups of the database have been made and I have the backup files but one of the backup files (the most recent one) is corrupted. During import via the DBCA interface I get a "invalid EXT descriptor signature" message when it is unpacking the files. From my own research, this appears to be a screwup on the part of SUN and how they implemented some things via Java.
    Request #1:
    Does anybody know how to fix this import issue with the backup files? (It will get me almost 2 years worth of data... remember.... Incredibly Rare backups...)
    Problem #2:
    There is still about 10 months worth of data that is sitting in the database from the last corrupted backup. I have a copy of the entire C:\Oracle directory from the mirror drive so the raw data is available to me.
    Request #2:
    Is there a way to import or merge this data with a working backup file (from 2005)? I'm under the assumption that 'overlay and pray' is not an option :)
    General Information:
    The original Oracle server is part of a small domain that was setup to perform a dedicated task. I am currently performing the recovery efforts on a dedicated server setup at home which models the software configuration of the original server that died. I can import a backup file from 2005 without any issues and the OraDim & sqlnet files don't report any errors. I have no trouble accessing or manipulating the data via the Enterprise Management Console or SQL+.
    Please forgive me if some of this is posted to the wrong section.
    Thank you in advance for any advice and/or help!
    Jeff Beasom-

    What you have been given is a toy.
    I call it a toy because infrequent backups, inadequate training, and an antique unpatched database clearly indicate that your management has not taken this seriously.
    It is time for someone to act like a professional and that appears to mean you.
    Forget this forum, open an SR at metalink, and follow Oracle's support advice.
    If your management has not paid for a support contract ... either they purchase one in the next 48 hours or ... update your resume and get out of there while you still have the skills to do so.

  • A question about CLASSPATH and Package

    The configuration of my computer is:
    Windows98, C:\j2sdk1.4.0
    Which in Autoexec.bat are included like this:
    path=C:\j2sdk1.4.0\bin
    set CLASSPATH=C:\j2sdk1.4.0\lib
    Then I make a new directory named t in C:\j2sdk1.4.0\lib, where there is a compiled file a.class, source code is:
    package t;
    public class a
    And another java file was in D:\t, named b.java, code like this:
    import t.*;
    class b extends a
    public static void main( String[] args )
    System.out.println("OK");
    Then I compiled like this: javac b.java, it was wrong; but when I compiled like this: javac -CLASSPATH C:\j2sdk1.4.0\lib b.java, It was OK!!! Why?? And then when I execute like this: java b, an error message was prompted(Can not find class t/a)!!! How can I do?

    First one general comment: I would not advise putting your own classes into C:\j2sdk1.4.0\lib since this suggests that the classes under this directory belong to the Java distribution. So my advice: create your own directory somewhere like D:\user\Classes or whatever.
    The directory (-ies) you specify in CLASSPATH are root entries telling the JVM where to start looking for classes. Why root entries? Well, the package structure is reflected in the directory structure relative to these roots. So a class of package t belongs into the subdirectory t of one of the directories specified in your CLASSPATH. This would be the case of your class a - by the way, the convention says that class names are capitalized. Since class b, on the other hand, is not in any package, it belongs irirectly into one of the directories of your CLASSPATH.
    Whereas the compiler is fairly forgiving about the location of your source files, the JVM is not. Invoking a class of some package requires you to provide the fully-qualified name to the java command. So if you wanted to run class a, you would have to invoke "java t.a". Starting class b, simply requires a call of "java b". But make sure the class file of class a is located in the subdirectory t of one of the directories specified in your CLASSPATH.

  • How java handles package/class names

    I am developing a strategy for internationalizing our company's middle-ware product. While I have no problem with the GUI's, exceptions, log files etc, I have no concept of how things like classpaths and packages can be specified in an asian language.
    For instance, if I have configuration information of com.abccompany.mypackage.MyClass, what will this look like to the asian user? Will they be able to change it to perhaps com.abccompany.mypackage.MyClass2 by entering localized data in Chinese or Arabic? I don't understand how this part works. On the command-line, will they type English script names? Do they run commands like so: java -cp com.abc.pkg1.jarfile.jar MyClass? Will my english filenames, packages, etc be represented in asian characters?
    We have a lot of configuration information that specify java classes as String data. I am concerned about the ability to modify this data and have it work correctly in languages that do not use the ascii character set. Is this something I need to be worried about?
    I appreciate any input. Thanks in advance.

    You do not need to warry about configuration information of com.abccompany.mypackage.MyClass
    and command-line no matter what languages used in Asia. Asian users also type in English script names or java -cp com.abc.pkg1.jarfile.jar MyClass as you do so. The only thing you need to note is
    that any text strings or messages which you want to show on any panel/dialog/window/frame and so on should be store in a resource file for internationalizing.

Maybe you are looking for

  • Output Binary data to browser as file

    I know this has been covered a thousand time, but every example I am given does not work. I am accessing a Java WebService to get a document (in this case PDF). This WS has no WDSL, so I am hitting it through CFHTTP. The WS returns me a hashmap with

  • Simple caching in singleton DAO

    Suppose I was to use a DAO like this in a web application. Different threads would be concurrently accessing this code from different servlets, struts actions, JSP pages, whatever. import java.util.Map; import java.util.HashMap; public class CacheSin

  • ADD CONTACT FIELD

    HI EXPERTS, We want to add a button or field when creating a contact with transaction BCT0. Anybody knows a User Exit related to this? Thanks in advance Nicolas SAP-ISU CS

  • Error on Service message

    Hi Guys, For a newly created service message, there is an error message for it and it's saying "Organization not available". I have alraedy checked the STP's Sales data area, and tried to re-populate the info and save again. But the error is still pe

  • Unable to deploy/run adf application in jdeveloper/ satandalone server

    Hi I am trying to deploy a simple ADF application (Fusion Web application) in Jdeveloper IDE (Integrated WL server)  - In this case, the server state is changing to RUNNING but no signs that the application is deployed and no Target URL is seen. Depl