Visit Jeremy's Blog.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 01-28-2002, 02:39 PM   #1
Senior Member
Registered: Jan 2002
Location: germany
Distribution: ubuntu, mint, suse
Posts: 1,550

Rep: Reputation: 137Reputation: 137
get startet with java (package)

I have a book about java that tells me that if I use:
"package mypack.something" i have to store the class in a directory like C:Java\mypack\something
I can't find out how that works running linux. I tried the analog version but the shells says 'wrong name' or 'can't find class' depending on which directory I'm in. Does someone have the time to give me a hint?
Would be great! Cheers J.
Old 01-30-2002, 07:44 PM   #2
LQ Newbie
Registered: Jan 2002
Location: Jacksonville, FL
Distribution: RedHat
Posts: 26

Rep: Reputation: 16
First thing you should know is that EVEN UNDER WINDOWS, Java cares about file name capitalization. A class named Xyz has to be in a file named (NOT, and compiles to Xyz.class.

Let's say I have a java file for package com.mousetech and the class it defines is named "Test". If I do a compile:

javac -d .

I'll see the following results in a directory tree view:
com <dir>
mousetech <dir>

So I can run it by saying:

java -classpath . com.mousetech.Test

Note that "." means the current (working) directory, that to run the application you have to give its complete name (package name and all - peoperly capitalized!). and that you don't need to say ".class" at the end.
Old 02-01-2002, 04:03 PM   #3
Senior Member
Registered: Jan 2002
Location: germany
Distribution: ubuntu, mint, suse
Posts: 1,550

Original Poster
Rep: Reputation: 137Reputation: 137
Thanks a lot ! It works now.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Java Package Problems logosys Programming 1 09-27-2005 02:39 PM
Installing java without using the package zwyrbla Slackware 9 01-25-2005 07:40 PM
Where is java 1.4.2_06 package acanton Slackware 2 12-27-2004 09:05 AM
Java Package problem? redshadow Programming 1 03-26-2004 08:27 AM
Java can't find package, but PATH set correctly (j2se1.4.0, java.util.regex package) Ethan Programming 5 02-06-2004 10:55 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:15 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration