Classpath for java and javac

Hi,
I'm a bit confused as to when include the "current" path to java/javac's "-classpath". For instance, if the project has the following structure:
test
  |___foo (package "foo")
         |___B.java (extends foo.A)
         |___A.javaand the "current" directory is at "test/", then a simple "javac foo/B.java" or "java foo.B" works. However, if the structure of the project is altered to the following:
test
  |___foo  (package "foo")
  |      |___B.java (extends foo.A and imports boo.C)
  |      |___A.java
  |
  |___myapp (just a directory)
          |____boo (package "boo")
                |____C.javathen in order to compile or run foo.B when the current directory is at "test/", I have to explicitly specify the "current" directory (or "."), i.e.
javac -classpath myapp/:. foo/B.java or java -cp myapp/:. foo.B
Why is it that in the first example, the current directory need not to be specified (".") but in the second example, it must? Is it because as soon as "-classpath/-cp" option is included in the command line, java ignores the default current path ("./")?
Sincerely,

If nothing is specified via -cp and no CLASSPATH is set, then the default classpath contains one entry, which is the current directory (a.k.a the classpath is ".").
If you set the classpath, then the classpath is exactly what you set it to and doesn't include any default.
That's the only reasonable way to model such things, because if you included the current directory in all cases, then that would produce many unexpected side effects.

Similar Messages

  • Starting tomcat server after setting classpath for java

    Sorry if this is nothing to do with java, it is more to do with starting tomcat server.
    Tomcat server has been working totally fine, but when I wanted to compile a java servlet I wrote for it, I needed to run a BAT file called gojava in MS-DOS that had the classpath for java to work properly. I then attempted to run Tomcat, but just got 'bad command'. As long as I don't start up java by setting the classpath, tomcat will work, but as I need java to write servlets and then to test them without restarting my PC each time, how do I get tomcat to work?
    Thanks
    Hannah

    Sounds like your batch file is changing your path, not your classpath. If you're getting "Bad command or filename" when attempting to run Tomcat, it can't find the executable. Check out the .bat file and see what it's doing (maybe even post it here for further clarity). If it's changing your path at all, make sure it includes a %path% to indicate that it simply wants to append items to the path, not overwrite it completely. Sorry if i'm way off base with my suggestions, but it sounds like that's where the problem's going to be, especially if rebooting resolves the problem.

  • I just ran a software update for Java and MacBook Pro SMC, now my Mini Display Port to HDMI TV is not working. The TV is flickering. The Mac Display is fine.

    I was just watching / streaming TV off Safari on my actual TV.
    I'm using a Mini-Display Port to HDMI cable for the connection to the external display.
    Software update popped-up and said there was an update for Java and for SMC.
    I ran the update and upon the computer restarting, my external display (my TV) is no longer working. It is now flickering.
    It won't work in Mirroring or set up as an extended display.
    I've reset SMC / PRAM / Safe Mode / Even restored from a Time Machine backup (From before the updates were done).
    What could it be?!

    I keep saying this over and over, in the hope that people who do a search will find it.  Apple cannot possibly test for or be reponsible for the bazillion combinations of adapter, cables, and TV's out there.  The only monitors that are 100% guaranteed to work with the MacBook Pro are the Cinema Displays and Thunderbolt Displays, because, they're made by Apple.  They're expensive, but they work perfectly.
    My guess is that you bought a cheap MDP to HDMI cable, or have a defective one.  From my reading of these boards over the past few months, cheap cables have a high failure rate.  And the regular priced ones have only a slightly less of one.  Try a new one.  Make sure you do not damage the Thunderbolt port.

  • Any difference between webdynpro for java and webdynpro for abap ?

    Hi all:
       I would like to build one small system in EP.
       I can choose to use webdynpro for java and webdynpro for abap.
       I would like to ask any major difference between webdynpro for abap and webdynpro for java ?
       Is fpm supported in webdynpro for abap ?

    Hi,
    see this thread,
    ABAP Vs JAVA WebDynpro
    Regads,
    J.Joe

  • Problem in setting path and classpath for java in RedHat linux 9

    Hi ,
    i am not able to set the PATH and CLASSPATH for j2sdk1.4.2_06
    I have tried with export PATH=$PATH:/usr/j2sdk1.4.2_06/bin
    and export CLASSPATH=$CLASSPATH:/usr/j2sdk1.4.2_06/lib
    in terminal
    but i want to configure it as permenant way for the jre and jdk
    and we should only type java or javac according to the requirement
    regards mihir...

    type those in .bashrc ... save and exit
    then at prompt, type 'source .bashrc'
    this is the permanent solution ...
    bhalo thakun

  • What files to download for java and oracle?

    Hey
    I have read that i have to download and implement some drivers to get oracle to work in
    java, but which should i download and where?
    Im using Oracle Express 10 and java 1.6
    Thanks

    Here's the link to get just the drivers
    http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/index.html
    You could also install the oracle client if you wish to use sql*plus, it has jdbc drivers in folder named jdbc. This is probably a good idea as sql*plus can prove whether your problem is java or oracle.
    Installation is simple, you put ojdbc14.jar in the classpath of your compiles and executions. If you are using an IDE, you follow what it provides in its documentation. For Java Studio Enterprise you add them from the "Runtime" window.

  • Netweaver Data base instances for Java and ABAP

    Hello Experts,
    Please help me to understand how the two technology stacks of SAP WAS (Java and ABAP) are configured to use underline data base in Netweaver.
    Is it manadatory to have two separate data base schemas, one for ABAP applications and other for Java applications in the Netweaver?
    If yes..the any idea about what are those schema differences??
    - Rajan

    Hello Krishna,
    Thanks for the reply.
    Is there any way I can access these shemas? Are they the same by structure or there are major differences?
    My requirement is to build a common schema out of these two and have the data from these two schemas to be consolidated in the new schema.
    Any help will be greatly appreciated.
    - Rajan

  • Forte for Java and webLogic

    How do I integrate WebLogic 6.1 and Forte for Java?

    Hi.
    You might check with Sun/Forte for info on how to do this.
    Regards,
    Michael
    Stjepan Maric wrote:
    How do I integrate WebLogic 6.1 and Forte for Java?--
    Michael Young
    Developer Relations Engineer
    BEA Support

  • WebDynpro for Java and GuideProcedure for workflow.

    Hi All,
    I need inputs on how to create Webdynpro java screns for GP and create a workflow using them .
    I will be thankfull if someone could help to know how to send an email notification also in this workflow scenario.
    Thanks and Regards,
    Sai

    Hello,
    WebDynpro Java will be 'exposed' as callable objects - these callable objects are assigned to particular actions in a business process designed. First off, read through Guided Procedures and how processes are designed.
    As for the e-mail, there's a template to send e-mails via Guided Procedures -- you can define that e-mail via a template available with a particular callable object.
    For more details on implementing the scenario, look through the context menu of this tutorial:
    [http://help.sap.com/saphelp_nw70ehp1/helpdata/en/b1/019742ad14c46ae10000000a155106/frameset.htm]
    Goodluck.
    Regards,
    Jan

  • WD for Java and UWL work items (Adobe HCMPF)

    Hi Experts,
    I am implementing the Adobe forms HCMPF from the HR Administartive Services BP based on  the 'old' WebDynrpo for Java. SAP references in SAPnote 1024326 that when the WD Java is preferred over the WD ABAP one can configure the Application Parameter "isEnabled=X" for the Java WD's.
    This application parameter works fine for iViews like Start Processes and Search Process. However, the problems come when you open the work item for approving/editing a form that is received in the UWL.
    These workitems call the WD application that is defined in ECC. However, they do not call an iView from the PCD but the application directly. Therefore I was not able to configure the Application Parameter "isEnabled=X" for these applications (eg sap.com/paasrformstep).
    Can anyone please help and explain how to set the application parameter property for applications that are called directly fron the UWL work items?
    Without this we can only start the processes but not contunue them after the workflow has started.
    You expertise is greatly appreciated and will be rewarded when helpful!
    Regards,
    Thomas

    Solution found.
    Edit the XML UWL configuration to inlcude the application property for the workflow work items in questions.

  • How to develop Web Dynpro for Java and run it locally

    I want to learn Web Dynpro for Java but still struggling with the running it locally in my PC. What software do I need to install in my own PC in order to do that? I have NWDS in place and I can write the code and compile it already. Thanks!

    Hi Anthony,
    You need to have SAP Web Application server  (SAP WAS) to run all the webdynpro applications. WAS can be installed either on your local system or on a server which can act as a central server.
    You can download WAS from SDN, which is a trial version. Check this link.
    http://www.sdn.sap.com/irj/scn/nw-downloads
    For checking the minimul system requirments for installing WAS please check the PAM (Product Availability Matrix).
    I hope this solves you issue. Please revert back in case you need any further information on this.
    Thanks and Regards
    Pravesh

  • Seeking recommendations for Java and servlet tutorials

    I am newbies in Java, except knowing some JavaScripts, JSP for web programming. Currently, I am using PHP, MySQL, Apache, and now I would like extend my skills to Java.
    I visited the java website, it seems to have many different packages and tech for different requirement. What should I learn for web programming? And which database is mostly fit for Java language? Mysql? oracle?

    If you want to do web programming, JSP and JavaScript is a good start. You'll also need to know servlets. Since you are new to Java, you'll also need to learn some of the basic classes. I would start with Sun's Java tutorial and when you have mastered that move on to their J2EE tutorial and focus on the chapters that deal with servlets, jsps and related technologies. The J2EE tutorial will include other topics that you may not want to learn right now.
    All major relational databases can be used with Java. The JDBC api can be used for all of them. There might be some minor differences in how you code you queries but the way you do things is the same regardless of the database.

  • Running java and javac

    Is there something I can do so I don't have to be in the same directory as the java.exe and javac.exe in order to use to run and compile?

    Go to the page you downloaded Java from, and read the JDK's Installation Instructions, paying particular attention to #5..

  • Need help for java and linux

    Hi, guys,
    I am being involved in a project.My current task is to build an interface using java. This interface will obtain some information from a linux-based software called NistNet, which is done by C and has GUI as well. My question is, can I use this java-based interface to obtain some information that is typed in this NistNet'GUI? If I can, how can I do that?
    Any hint available?
    Thanks!

    You can bridge between Java and C using the "Java Native Interface" (JNI). There used to be a good tutorial on this site but it vanished for no apparent reason in some resent update, so try a websearch.
    See also
    http://java.sun.com/j2se/1.4/docs/guide/jni/
    http://java.sun.com/j2se/1.5.0/docs/guide/jni/

  • Xml SQL Utility for java and Dr.Watson for WIN-NT

    hello everybody.
    when i am running the sample code in xml Sql utility for java documentation,
    Dr. watson for windows NT error occures.
    what may be the problem? please suggest a solution
    thanks
    dev

    Set JDK_HOME to the directory where you install your JDK (Java Development Kit).
    So instance, I've install JDK1.1.8 on my
    C drive so
    set JDK_HOME=c:\jdk1.1.8;c:\jdk1.1.8\bin

Maybe you are looking for

  • How to add text to the carousel images ?

    <%--   Copyright 1997-2010 Day Management AG   Barfuesserplatz 6, 4001 Basel, Switzerland   All Rights Reserved.   This software is the confidential and proprietary information of   Day Management AG, ("Confidential Information"). You shall not   dis

  • Position Based Security

    Hi All, How to find out whether the security implemented is position based or role based. and in position based is there any difference in delaing with authorisation changes,  compared to roled based security. Can some one please let me know the info

  • Hasmap.put,get infinite loop, 27.6 optimizer problem

    Helo, We have a very busy (3000 users) Weblogic Portal and Weblogic Integration instance. We found that some times (once a week) weblogic server threads go to infinite loop doing hasmap.get, hashmap put or hashmap remove operations. Our developers fo

  • Photoshop CC freezing!

    I've had Photoshop CC for about a good month now and it's been working fine until about a week ago! I always make GIFs using my Photoshop CC, so I'm always using the File>Import>Video frames to layers button BUT now when I press 'Video frames to laye

  • ME 37 BAPI needed

    Hi all I want to know the BAPI's for ME37, I want to create the schedule agreement and source list using the BAPI Points for all helpful answers as always.