LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices

Reply
 
Search this Thread
Old 01-28-2002, 02:39 PM   #1
j-ray
Senior Member
 
Registered: Jan 2002
Location: germany
Distribution: ubuntu
Posts: 1,437

Rep: Reputation: 103Reputation: 103
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
mtsinc
LQ Newbie
 
Registered: Jan 2002
Location: Jacksonville, FL
Distribution: RedHat
Posts: 24

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 Xyz.java (NOT xyz.java), 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 . Test.java

I'll see the following results in a directory tree view:

Test.java
com <dir>
|
mousetech <dir>
|
Test.class

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
j-ray
Senior Member
 
Registered: Jan 2002
Location: germany
Distribution: ubuntu
Posts: 1,437

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


Reply


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


All times are GMT -5. The time now is 12:17 AM.

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