Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #28812 > unrolled thread

Where is Java class located on Linux systems?

Started byTom Tylor <tomcmpt@gmail.com>
First post2014-06-21 20:52 -0700
Last post2014-06-25 08:13 -0700
Articles 5 — 5 participants

Back to article view | Back to comp.lang.java.programmer


Contents

  Where is Java class located on Linux systems? Tom Tylor <tomcmpt@gmail.com> - 2014-06-21 20:52 -0700
    Re: Where is Java class located on Linux systems? markspace <markspace@nospam.nospam> - 2014-06-21 23:52 -0700
    Re: Where is Java class located on Linux systems? lipska the kat <lipskathekat@example.com> - 2014-06-22 08:33 +0100
    Re: Where is Java class located on Linux systems? Jeff Higgins <jeff@invalid.invalid> - 2014-06-22 08:00 -0400
    Re: Where is Java class located on Linux systems? Roedy Green <see_website@mindprod.com.invalid> - 2014-06-25 08:13 -0700

#28812 — Where is Java class located on Linux systems?

FromTom Tylor <tomcmpt@gmail.com>
Date2014-06-21 20:52 -0700
SubjectWhere is Java class located on Linux systems?
Message-ID<dd8b1a26-3168-454d-94ed-ddc473e28740@googlegroups.com>
Hi all,

For the "import ...;" lines, I just wonder where the class files are located on my system. Can anyone help?

Thanks!

Best,
Tom

[toc] | [next] | [standalone]


#28813

Frommarkspace <markspace@nospam.nospam>
Date2014-06-21 23:52 -0700
Message-ID<lo5uer$9gf$1@dont-email.me>
In reply to#28812
On 6/21/2014 8:52 PM, Tom Tylor wrote:

> For the "import ...;" lines, I just wonder where the class files are
> located on my system. Can anyone help?
>

On the classpath.  I'm a little fuzzy on the exact details, and it 
depends what tool you use (each IDE will have its own rules, for 
example) but generally speaking each tool will read the classpath to 
resolve any imports.

http://docs.oracle.com/javase/tutorial/essential/environment/paths.html

The latest compilers (javac) use a special abbreviated file to reference 
system classes.  This doesn't include classes from rt.jar which you 
normally shouldn't access.  So if a class from the sun.* hierarchy stops 
being located during a compile, you have to use a special little bit of 
magic to get javac to use the full rt.jar.

[toc] | [prev] | [next] | [standalone]


#28814

Fromlipska the kat <lipskathekat@example.com>
Date2014-06-22 08:33 +0100
Message-ID<VridnaV7B-lFGzvOnZ2dnUVZ7oudnZ2d@bt.com>
In reply to#28812
On 22/06/14 04:52, Tom Tylor wrote:
> Hi all,
>
> For the "import ...;" lines, I just wonder where the class files are located on my system. Can anyone help?
>
> Thanks!
>
> Best,
> Tom
>

Thew short answer is ... it depends

On my particular Ubuntu Linux 12.04 LTS dev box I install the JDK 
locally, which allows me to log into different accounts to use different 
versions (there are other ways to do this).

So, my rt.jar resides in
/home/lipska/java/jdk1.7.0_51/jre/lib

I have a source directory
~/source/java for the source code

and a class directory
~/java/classes for the compiled classes

I add this directory tree to the IDE classpath

I also have a CentOS based system running as a server

java is installed in /opt/jdk1.7.0_51 so the rt.jar resides in
/opt/jdk1.7.0_51/jre/lib

My applications are deployed as jar files which are made available to 
the server by adding them to the server classpath which is usually done 
automatically if you deploy to the default location.

Finally, you can usually discover a class file (not encapsulated in a 
jar file) on systems that have the 'locate' facility as follows

$ sudo updatedb
$ locate SomeClass.class


-- 
lipska the kat - treacherous feline.
Proudly nominated for IPOTY 2014 - LIGAF
GNU/Linux user #560883 - linuxcounter.net

[toc] | [prev] | [next] | [standalone]


#28817

FromJeff Higgins <jeff@invalid.invalid>
Date2014-06-22 08:00 -0400
Message-ID<lo6gr8$n34$1@dont-email.me>
In reply to#28812
On 06/21/2014 11:52 PM, Tom Tylor wrote:
> Hi all,
>
> For the "import ...;" lines, I just wonder where the class files are located on my system. Can anyone help?
>
JDK Tools and Utilities
<http://docs.oracle.com/javase/8/docs/technotes/tools/>

General Information
<http://docs.oracle.com/javase/8/docs/technotes/tools/#general>

How Classes are Found
<http://docs.oracle.com/javase/8/docs/technotes/tools/findingclasses.html>

[toc] | [prev] | [next] | [standalone]


#28847

FromRoedy Green <see_website@mindprod.com.invalid>
Date2014-06-25 08:13 -0700
Message-ID<lkplq9572vimq8n02rspc9ks0atgsfoecv@4ax.com>
In reply to#28812
On Sat, 21 Jun 2014 20:52:03 -0700 (PDT), Tom Tylor
<tomcmpt@gmail.com> wrote, quoted or indirectly quoted someone who
said :

>
>For the "import ...;" lines, I just wonder where the class files are located on my system. Can anyone help?

You import classes, not the filenames of classes, so it does not
matter where on disk they are, the import stays the same.

Your classes files are where you/javac put them, or where your IDE put
them.  Use a tool to search for *.class files to find them.

Then use Classpath to tell the compiler or runtime where to look for
them.

see http://mindprod.com/jgloss/classpath.html
-- 
Roedy Green Canadian Mind Products http://mindprod.com
Why program by hand in 5 days what you can spend
2 to 5 years of your life automating.
~ Terence Parr 1964-08-17

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.java.programmer


csiph-web