Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

a question about jdk1.4~~~help~~~

Posted on 2002-04-21
7
Medium Priority
?
266 Views
Last Modified: 2010-03-30
i have a servlet and a CheckUser class. the CheckUser class and the servlet in different path.
so if the servlet want to use CheckUser class must import it..if commented out "import CheckUser;",
the compiler will say "can't find class CheckUser".

but in the CheckUser class, we did not use something like "package com.***.***"....we just put CheckUser
class in a path which is exist in the CLASSPATH...

in jdk 1.3 no problem. but the problem appears in jdk1.4..a error report: says '.' expected

as CEHJ said: Java classes are *always* in packages, even if there is no 'package' declaration...
so, i want to know which package CheckUser belongs to? because i didnot use 'package' declaration.....(if
CheckUser.java in path /home/com/***/ and /home/com/*** in the CLASSPATH)
0
Comment
Question by:wh111
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 16

Expert Comment

by:heyhey_
ID: 6957504
post the full javac error message
0
 
LVL 35

Expert Comment

by:girionis
ID: 6957583
 And post your servlet code as well...
0
 
LVL 86

Accepted Solution

by:
CEHJ earned 800 total points
ID: 6957645
The way to avoid the compiler error is to compile thus:
javac -sourcepath <path to CheckUser> <filename>.java
There is no need then to import CheckUser at all.

What I would say though, is that one ought to minimise source file dispersal. Think about the comment you made about packages. If there are the correct relations between packages, there is no need to yank together dispersed source.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 5

Expert Comment

by:nebeker
ID: 6959738
Java 1.4 is a lot more strict about import statements...
0
 
LVL 9

Expert Comment

by:Ovi
ID: 6962168
Normally if you are sure that your file is in the classparh, never will be necesary to import'it.
0
 
LVL 9

Expert Comment

by:Venci75
ID: 7973096
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
Answered by: CEHJ
Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
Venci75
EE Cleanup Volunteer
0
 

Expert Comment

by:SpideyMod
ID: 8021383
per recommendation

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses

636 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