Solved

Basic java question

Posted on 2002-04-11
9
259 Views
Last Modified: 2010-05-18
I want to write quick and dirty classes to
learn string , array etc techniques.  Just a few classes
created using notepad and then compile then with the command line and run them without the gooey. The kind of stuff you see in basic java books.

My question is:  what directory do I put the .java files
in - there is a particular location relative to my java set up - and how do I find it (jdk  1.xxx I seem to remember)

Sorry for the long question, but the answer will be a snap for a lot of you guys.....
0
Comment
Question by:theworpler
9 Comments
 
LVL 92

Accepted Solution

by:
objects earned 50 total points
ID: 6933357
> what directory do I put the .java files in

Wherever you want, just add the directory to your classpath.
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 6933491
Create a 'projects' directory under your installation (<JAVA_HOME>) directory.
For rough work, I normally put things in <JAVA_HOME>\projects\misc, using no packages.
For more serious stuff, I create a new directory under projects, such as <JAVA_HOME>\projects\important.
0
 

Expert Comment

by:rashidkamranbs
ID: 6934249
There is no hard and fast rule until you use the package statement in your source file.. that  is you can place .java files any where in our directory structure but if you are using package statement for example

package mypackages.utils;

then its mendatory to put them in mypackages/utils directory .. no matter where these two are for example if  i m on windows machine
it could be

c:\projects\mypackages\utils

or it could be
c:\mainprojects\subprojects\mypackages\utils

but if there is no package statement then you are free and place ne where ya want..

as for JDK  if ya want to access the javac and java from anywhere.. then bin directory of the jdk installations should be in your system's path. or you  can execute by enterting the full path

0
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

 
LVL 35

Expert Comment

by:girionis
ID: 6937359
>> what directory do I put the .java files in
>Wherever you want, just add the directory to your classpath.

  Wherever you want but you do not have to put the directory in your classpath (although you could if you wanted to). Add to your classpath the directory where you keep your .class files and not the .java files (except if the .java and .class files are i nthe same subdirectory).
0
 
LVL 92

Expert Comment

by:objects
ID: 6937913
> except if the .java and .class files are i nthe same subdirectory

Sorry, as they were keeping things simple I was assuming that the class files were in the same directory.
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 6956579
ADMINISTRATION WILL BE CONTACTING YOU SHORTLY.  Moderators Computer101 or Netminder will return to finalize these if still open in seven days.  Please post closing recommendations before that time.

Question(s) below appears to have been abandoned. Your options are:
 
1. Accept a Comment As Answer (use the button next to the Expert's name).
2. Close the question if the information was not useful to you, but may help others. You must tell the participants why you wish to do this, and allow for Expert response.  This choice will include a refund to you, and will move this question to our PAQ (Previously Asked Question) database.  If you found information outside this question thread, please add it.
3. Ask Community Support to help split points between participating experts, or just comment here with details and we'll respond with the process.
4. Delete the question (if it has no potential value for others).
   --> Post comments for expert of your intention to delete and why
   --> YOU CANNOT DELETE A QUESTION with comments; special handling by a Moderator is required.

For special handling needs, please post a zero point question in the link below and include the URL (question QID/link) that it regards with details.
http://www.experts-exchange.com/jsp/qList.jsp?ta=commspt
 
Please click this link for Help Desk, Guidelines/Member Agreement and the Question/Answer process.  http://www.experts-exchange.com/jsp/cmtyHelpDesk.jsp

Click you Member Profile to view your question history and please keep them updated. If you are a KnowledgePro user, use the Power Search option to find them.  

Questions which are LOCKED with a Proposed Answer but do not help you, should be rejected with comments added.  When you grade the question less than an A, please comment as to why.  This helps all involved, as well as others who may access this item in the future.  PLEASE DO NOT AWARD POINTS TO ME.

To view your open questions, please click the following link(s) and keep them all current with updates.
http://www.experts-exchange.com/questions/Q.20136013.html
http://www.experts-exchange.com/questions/Q.20136061.html
http://www.experts-exchange.com/questions/Q.20136077.html
http://www.experts-exchange.com/questions/Q.20172167.html
http://www.experts-exchange.com/questions/Q.20177844.html
http://www.experts-exchange.com/questions/Q.20177845.html
http://www.experts-exchange.com/questions/Q.20177846.html
http://www.experts-exchange.com/questions/Q.20224162.html
http://www.experts-exchange.com/questions/Q.20268951.html
http://www.experts-exchange.com/questions/Q.20287427.html
http://www.experts-exchange.com/questions/Q.20287345.html
http://www.experts-exchange.com/questions/Q.20290450.html




*****  E X P E R T S    P L E A S E  ******  Leave your closing recommendations if this item remains inactive another seven (7) days.  If you are interested in the cleanup effort, please click this link http://www.experts-exchange.com/jsp/qManageQuestion.jsp?ta=commspt&qid=20274643 
POINTS FOR EXPERTS awaiting comments are listed here -> http://www.experts-exchange.com/commspt/Q.20277028.html
 
Moderators will finalize this question if in @7 days Asker has not responded.  This will be moved to the PAQ (Previously Asked Questions) at zero points, deleted or awarded.
 
Thank you everyone.
 
Moondancer
Moderator @ Experts Exchange
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 7074146
Ignored/finalized.  Asker logged in again today and still hasn't handled these questions.  Administration once again advised.

Moondancer - EE Moderator
0
 
LVL 92

Expert Comment

by:objects
ID: 7074289
Thanks mate :-)
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 7074309
Sorry you had to wait so long, and thank you for your help.  :)
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question